Skip to content

Instantly share code, notes, and snippets.

@thomasgwatson
Created April 18, 2018 23:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomasgwatson/a60e973207ff9387f68adfe2426755b8 to your computer and use it in GitHub Desktop.
Save thomasgwatson/a60e973207ff9387f68adfe2426755b8 to your computer and use it in GitHub Desktop.
Sample Webpack 4 config
const HtmlWebPackPlugin = require('html-webpack-plugin')
const htmlWebpackPlugin = new HtmlWebPackPlugin({
template: './src/index.html',
filename: './index.html'
})
module.exports = {
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader'
}
},
{
test: /\.css$/,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
modules: true,
importLoaders: 1,
localIdentName: '[name]_[local]_[hash:base64]', // Allows for duplicate class names between components
sourceMap: true,
minimize: true
}
},
'postcss-loader'
]
}
]
},
plugins: [htmlWebpackPlugin],
devServer: {
historyApiFallback: true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment