Skip to content

Commit

Permalink
Update UMD builds to include 3rd party libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
frenzzy committed May 31, 2016
1 parent f18d0aa commit 81b3f80
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@
"mocha": "^2.4.5",
"rollup": "^0.26.3",
"rollup-plugin-babel": "^2.4.0",
"rollup-plugin-commonjs": "^2.2.1",
"rollup-plugin-node-resolve": "^1.5.0",
"rollup-plugin-uglify": "^0.3.1",
"sinon": "^2.0.0-pre"
},
Expand Down
13 changes: 9 additions & 4 deletions tools/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ const del = require('del');
const rollup = require('rollup');
const babel = require('rollup-plugin-babel');
const uglify = require('rollup-plugin-uglify');
const commonjs = require('rollup-plugin-commonjs');
const nodeResolve = require('rollup-plugin-node-resolve');
const pkg = require('../package.json');

// The source files to be compiled by Rollup
Expand Down Expand Up @@ -71,20 +73,23 @@ promise = promise.then(() => del(['build/*']));
for (const file of files) {
promise = promise.then(() => rollup.rollup({
entry: 'src/main.js',
external: Object.keys(pkg.dependencies),
external: file.format === 'umd' ? [] : Object.keys(pkg.dependencies),
plugins: [
babel(Object.assign(pkg.babel, {
...file.format === 'umd' ? [nodeResolve({ browser: true }), commonjs()] : [],
babel({
babelrc: false,
exclude: 'node_modules/**',
runtimeHelpers: true,
presets: file.presets,
plugins: file.plugins,
})),
].concat(file.minify ? [uglify()] : []),
}),
...file.minify ? [uglify()] : [],
],
}).then(bundle => bundle.write({
dest: `build/${file.output || 'main'}${file.ext}`,
format: file.format,
sourceMap: !file.minify,
exports: 'named',
moduleName: file.moduleName,
})));
}
Expand Down

0 comments on commit 81b3f80

Please sign in to comment.