generated from BeckyPollard/project-quickstart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.prod.js
30 lines (29 loc) · 814 Bytes
/
webpack.prod.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const path = require('path');
const common = require('./webpack.common');
const {merge} = require('webpack-merge');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = merge(common, {
mode: 'production',
output: {
assetModuleFilename: 'assets/images/[hash][ext]',
filename: 'scripts/[name].bundle.js',
path: path.resolve(__dirname, 'build'),
},
plugins: [
new MiniCssExtractPlugin(),
new CleanWebpackPlugin(),
],
module: {
rules: [
{
test: /\.scss$/,
use: [
MiniCssExtractPlugin.loader, // 3. extract css into files
'css-loader', // 2. turns css into js
'sass-loader', // 1. turns scss into css
],
},
],
},
});