Created
March 17, 2019 19:17
-
-
Save mtth/10fd54736e9eb98d50bbb0a49b122c9d to your computer and use it in GitHub Desktop.
Rollup `@avro/types`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** The most minimal module possible. */ | |
'use strict'; | |
module.exports = require('@avro/types'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "avro-types-rollup-example", | |
"dependencies": { | |
"@avro/types": "~0.3.11" | |
}, | |
"devDependencies": { | |
"rollup": "~1.6.0", | |
"rollup-plugin-commonjs": "~9.2.1", | |
"rollup-plugin-node-builtins": "~2.1.2", | |
"rollup-plugin-node-resolve": "~4.0.1", | |
"rollup-plugin-terser": "~4.0.4" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const rollup = require('rollup'); | |
const resolve = require('rollup-plugin-node-resolve'); | |
const cjs = require('rollup-plugin-commonjs'); | |
const terser = require('rollup-plugin-terser').terser; | |
const builtins = require('rollup-plugin-node-builtins'); | |
async function build() { | |
const bundle = await rollup.rollup({ | |
input: './index.js', | |
plugins: [ | |
builtins(), | |
resolve({ | |
browser: true, | |
preferBuiltins: false, | |
only: ['@avro/types'], | |
}), | |
cjs(), | |
terser(), | |
] | |
}); | |
await bundle.write({ | |
name: "leader", | |
format: 'iife', | |
file: './bundle.js', | |
sourcemap: true | |
}); | |
} | |
build().catch(err => { console.error(err); }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment