Skip to content
Permalink
Browse files

SourceMaps enabled

  • Loading branch information...
Mcafee123 committed Apr 23, 2019
1 parent c861973 commit 69082a216939cce9fe2388e27d5741a1e91ea4ba
Showing with 14 additions and 8 deletions.
  1. +2 −4 package.json
  2. +12 −4 webpack.config.js
@@ -7,10 +7,8 @@
"start": "npm run bundle-dev && webpack-dev-server --env.development --open",
"bundle-dev": "npm run build-dev && webpack --env.development",
"bundle": "npm run build && webpack",
"build-dev": "npm run build-types && npm run babel-dev",
"build": "npm run build-types && npm run babel",
"babel-dev": "babel src --out-dir lib --extensions \".ts\" --source-maps both",
"babel": "babel src --out-dir lib --extensions \".ts\"",
"build-dev": "npm run type-check && npm run build-types && babel src --out-dir lib --extensions \".ts\" --source-maps both",
"build": "npm run type-check && babel src --out-dir lib --extensions \".ts\" --delete-dir-on-start",
"build-types": "tsc --emitDeclarationOnly",
"type-check": "tsc --noEmit",
"type-check:watch": "npm run type-check -- --watch"
@@ -5,21 +5,29 @@ const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin')
module.exports = (env, argv) => {

env = (env && env.development !== undefined) ? env : { development: false }
console.log(env)
if (env.development === true) {
env.mode = 'development'
} else {
env.mode = 'production'
}

const cfg = base(env, argv)
// mode
// set build mode
cfg.mode = env.mode
// minimize
if (!env.development) {

if (env.mode === 'production') {
// minimize for production builds
cfg.optimization = {
minimizer: [new TerserJSPlugin({}), new OptimizeCSSAssetsPlugin({})]
}
// no source-maps
cfg.devtool = false
console.log('Minimize, don\'t create Source Maps')
} else {
// don't minimize
// source-maps
cfg.devtool = 'source-map'
console.log('Don\'t minimize, create Source Maps')
}

console.log('')

0 comments on commit 69082a2

Please sign in to comment.
You can’t perform that action at this time.