Created
September 7, 2019 08:34
-
-
Save thanapongp/3a74c9af31ce91ebf79e12d676e58874 to your computer and use it in GitHub Desktop.
wepack.config.js with MiniCssExtractPlugin
This file contains hidden or 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 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