Created
April 18, 2018 23:10
-
-
Save thomasgwatson/a60e973207ff9387f68adfe2426755b8 to your computer and use it in GitHub Desktop.
Sample Webpack 4 config
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 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