-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
44 lines (42 loc) · 1.17 KB
/
webpack.config.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
const webpack = require('webpack');
const HtmlPlugin = require('html-webpack-plugin');
const CSSExtract = require('mini-css-extract-plugin');
const path = require('path');
const paths = {
index: path.resolve(__dirname, 'src', 'index.js'),
template: path.resolve(__dirname, 'src', 'index.html'),
};
/** @returns {webpack.Configuration} */
module.exports = (_, argv) => ({
entry: {
index: paths.index,
},
resolve: {
extensions: ['.js', '.scss', '.html'],
},
module: {
rules: [
{
test: /\.(sc|c)ss/,
use: [
{
loader: CSSExtract.loader,
},
'css-loader',
'sass-loader',
],
},
{ test: /\.png/, use: 'file-loader' },
{ test: /\.svg/, use: 'svg-url-loader' },
],
},
devtool: 'source-map',
plugins: [
new webpack.ProgressPlugin(),
new CSSExtract(),
new HtmlPlugin({
template: paths.template,
filename: argv.mode === 'production' ? '../index.html' : 'index.html',
}),
],
});