From b8100e162c95dbed3510c6c1de49a24a645e1325 Mon Sep 17 00:00:00 2001 From: cpsdqs Date: Sun, 17 Sep 2017 20:44:32 +0200 Subject: [PATCH] Ignore demo when ESP_PROD is in env --- _build_js.sh | 25 ------------------------- webpack.config.js | 15 ++++++++++++++- 2 files changed, 14 insertions(+), 26 deletions(-) diff --git a/_build_js.sh b/_build_js.sh index 104de65..7321e48 100755 --- a/_build_js.sh +++ b/_build_js.sh @@ -7,28 +7,3 @@ php ./dump_js_lang.php echo 'Processing JS...' npm run webpack -exit - -if [[ $ESP_PROD ]]; then - smarg= - demofile= -else - smarg=--source-maps - demofile=js/demo.js -fi - -npm run babel -- -o "out/js/app.$FRONT_END_HASH.js" ${smarg} js/lib \ - js/lib/chibi.js \ - js/lib/polyfills.js \ - js/event_emitter.js \ - js/utils.js \ - js/modal.js \ - js/notif.js \ - js/appcommon.js \ - $demofile \ - js/lang.js \ - js/wifi.js \ - js/term_* \ - js/debug_screen.js \ - js/soft_keyboard.js \ - js/term.js diff --git a/webpack.config.js b/webpack.config.js index fa9d289..1643079 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,8 +1,20 @@ +const webpack = require('webpack') const { execSync } = require('child_process') const path = require('path') let hash = execSync('git rev-parse --short HEAD').toString().trim() +let plugins = [] +let devtool = 'source-map' + +if (process.env.ESP_PROD) { + // ignore demo + plugins.push(new webpack.IgnorePlugin(/\.\/demo(?:\.js)?$/)) + + // no source maps + devtool = '' +} + module.exports = { entry: './js', output: { @@ -17,5 +29,6 @@ module.exports = { } ] }, - devtool: 'source-map' + devtool, + plugins }