diff options
| author | rr- <rr-@sakuya.pl> | 2016-05-20 23:10:45 +0200 |
|---|---|---|
| committer | rr- <rr-@sakuya.pl> | 2016-05-21 00:08:43 +0200 |
| commit | 249d6073c03f68637d867147e85f0bf76acc5bdb (patch) | |
| tree | e7db76a10ef655b66e24655707b75096dc8fb8db /client/build.js | |
| parent | 69fe8ec31a0827eda913e55ca464228168ffcaf1 (diff) | |
client/build: remove babel when not transpiling
Diffstat (limited to 'client/build.js')
| -rw-r--r-- | client/build.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/client/build.js b/client/build.js index 9b19337..fbf378d 100644 --- a/client/build.js +++ b/client/build.js @@ -117,7 +117,6 @@ function writeJsBundle(b, path, message, compress) { } function bundleJs(config) { - const babelify = require('babelify'); const browserify = require('browserify'); const external = [ 'lodash', @@ -126,7 +125,6 @@ function bundleJs(config) { 'js-cookie', 'page', 'nprogress', - 'babel-polyfill', ]; glob('./js/**/*.js', {}, (er, files) => { if (!process.argv.includes('--no-vendor-js')) { @@ -134,6 +132,9 @@ function bundleJs(config) { for (let lib of external) { b.require(lib); } + if (config.transpile) { + b.add(require.resolve('babel-polyfill')); + } writeJsBundle( b, './public/vendor.min.js', 'Bundled vendor JS', true); } @@ -142,7 +143,7 @@ function bundleJs(config) { let outputFile = fs.createWriteStream('./public/app.min.js'); let b = browserify({debug: config.debug}); if (config.transpile) { - b = b.transform(babelify); + b = b.transform('babelify'); } writeJsBundle( b.external(external).add(files), |