Ignore demo when ESP_PROD is in env

box-drawing
cpsdqs 7 years ago
parent ef249ebc79
commit b8100e162c
Signed by untrusted user: cpsdqs
GPG Key ID: 3F59586BB7448DD1
  1. 25
      _build_js.sh
  2. 15
      webpack.config.js

@ -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

@ -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
}

Loading…
Cancel
Save