Skip to content

Instantly share code, notes, and snippets.

@mtth
Created March 17, 2019 19:17
Show Gist options
  • Save mtth/10fd54736e9eb98d50bbb0a49b122c9d to your computer and use it in GitHub Desktop.
Save mtth/10fd54736e9eb98d50bbb0a49b122c9d to your computer and use it in GitHub Desktop.
Rollup `@avro/types`
/** The most minimal module possible. */
'use strict';
module.exports = require('@avro/types');
{
"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"
}
}
'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