Skip to content

Instantly share code, notes, and snippets.

@agrcrobles
Created December 12, 2018 10:19
Show Gist options
  • Save agrcrobles/ae7e87acb7ad0f62ba57b41c33e3a537 to your computer and use it in GitHub Desktop.
Save agrcrobles/ae7e87acb7ad0f62ba57b41c33e3a537 to your computer and use it in GitHub Desktop.
Minimum webpack 4 dev server

Install deps

npm init
npm i --save-dev webpack webpack-cli webpack-dev-server
<script src="/bundle.js"></script>
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