-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.dev.js
69 lines (68 loc) · 1.64 KB
/
webpack.dev.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
const path = require('path')
const merge = require('webpack-merge')
const webpackCommon = require('./webpack.common')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const files = ['index', 'vertical', 'all']
const autoprefixer = require('autoprefixer')
const DEV_MODE = process.env.npm_lifecycle_event == 'start'
module.exports = merge(webpackCommon, {
mode: 'development',
devtool: 'eval-source-map',
entry: {
dragscroll: path.resolve(__dirname, 'public/js/docs.ts'),
},
plugins: [
...files.map((file) => {
return new HtmlWebpackPlugin({
filename: `${file}.html`,
template: path.resolve(__dirname, `public/${file}.ejs`),
})
}),
new MiniCssExtractPlugin({
filename: `[name].css`,
}),
],
module: {
rules: [
{
test: /\.(scss)/,
use: [
{
loader: MiniCssExtractPlugin.loader,
},
{
loader: 'css-loader',
options: {
sourceMap: DEV_MODE,
},
},
{
loader: 'postcss-loader',
options: {
plugins: () => [autoprefixer()],
sourceMap: DEV_MODE,
},
},
{
loader: 'sass-loader',
options: {
sourceMap: DEV_MODE,
},
},
],
},
],
},
devServer: {
inline: true,
hot: true,
contentBase: [path.resolve('build'), path.resolve('public')],
open: true,
compress: true,
writeToDisk: true,
watchOptions: {
poll: true,
},
},
})