npm init
npm i --save-dev webpack webpack-cli webpack-dev-server
Created
December 12, 2018 10:19
-
-
Save agrcrobles/ae7e87acb7ad0f62ba57b41c33e3a537 to your computer and use it in GitHub Desktop.
Minimum webpack 4 dev server
npm run start:dev
MIT
This file contains 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
<script src="/bundle.js"></script> |
This file contains 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"); | |
const path = require("path"); | |
module.exports = { | |
context: path.resolve(__dirname, "src"), | |
entry: "./index.js", | |
output: { | |
path: path.resolve(__dirname, "dist"), | |
filename: "bundle.js" | |
}, | |
plugins: [ | |
new webpack.DefinePlugin({ | |
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV) | |
}) | |
] | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment