Skip to content

Instantly share code, notes, and snippets.

@tommylinks
Created January 16, 2020 15:29
Show Gist options
  • Save tommylinks/399ba7b95038f8709c97a20335bfc942 to your computer and use it in GitHub Desktop.
Save tommylinks/399ba7b95038f8709c97a20335bfc942 to your computer and use it in GitHub Desktop.
//scripts for package.json
// "scripts": {
// "start": "webpack-dev-server --mode development --open",
// "build": "webpack --mode production"
// },
const path = require('path')
const HTMLPlugin = require('html-webpack-plugin')
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
module.exports = {
entry: './src/app.js',
output: {
filename: 'bundle.[chunkhash].js',
path: path.resolve(__dirname, 'public')
},
devServer: {
port: 3000
},
plugins: [
new HTMLPlugin({
template: './src/index.html'
}),
new CleanWebpackPlugin()
],
module: {
rules: [
{
test: /\.css$/i,
use: ['style-loader', 'css-loader'],
},
],
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment