Skip to content

Instantly share code, notes, and snippets.

@thanapongp
Created September 7, 2019 08:34
Show Gist options
  • Select an option

  • Save thanapongp/3a74c9af31ce91ebf79e12d676e58874 to your computer and use it in GitHub Desktop.

Select an option

Save thanapongp/3a74c9af31ce91ebf79e12d676e58874 to your computer and use it in GitHub Desktop.
wepack.config.js with MiniCssExtractPlugin
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
entry: './src/js/main.js',
mode: 'development',
plugins: [
new MiniCssExtractPlugin({
filename: '[name].css',
}),
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'src/index.html'
}),
],
module: {
rules: [
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, 'css-loader'],
}
]
},
output: {
filename: 'index.js',
path: path.resolve(__dirname, 'dist')
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment