Last active
March 3, 2018 07:52
-
-
Save a1exlism/2daf1ce6a2b6f830e22247494ec1f302 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* package.json */ | |
{ | |
/* add --mode in webpack4.x */ | |
"scripts": { | |
"dev": "cross-env DEBUG=true webpack-dev-server --open", | |
}, | |
/* ... */ | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.write('<h1>Hello World</h1>'); | |
if (__DEV__) { | |
document.write(new Date()); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const webpack = require('webpack'); | |
let devFlagPlugin = new webpack.DefinePlugin({ | |
__DEV__: JSON.stringify(JSON.parse(process.env.DEBUG || 'false')) | |
}); | |
module.exports = { | |
entry: './main.js', | |
output: { | |
filename: 'bundle.js' | |
}, | |
plugins: [devFlagPlugin] | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment