-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
72 lines (69 loc) · 1.7 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
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
70
71
72
// old code only
const path = require("path");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
module.exports = {
entry: {
layout: ["./src/client/js/layout.js", "./src/client/scss/layout.scss"],
intro: ["./src/client/js/intro.js", "./src/client/scss/screens/intro.scss"],
main: ["./src/client/js/main.js", "./src/client/scss/screens/main.scss"],
nav: ["./src/client/js/nav.js"],
test: ["./src/client/js/test.js", "./src/client/scss/screens/test.scss"],
},
plugins: [
new MiniCssExtractPlugin({
filename: "css/[name].css",
// filename: "css/styles.css",
}),
],
watchOptions: {
ignored: /node_modules/,
// aggregateTimeout: 3000,
// poll: 1000,
},
output: {
filename: "js/[name].js",
path: path.resolve(__dirname, "assets"),
clean: true,
},
module: {
rules: [
{
test: /\.(png|jpe?g|gif)$/i,
loader: "file-loader",
options: {
name: "img/[name].[ext]",
},
},
{
test: /\.js$/,
use: {
loader: "babel-loader",
options: {
presets: [["@babel/preset-env", { targets: "defaults" }]],
},
},
},
{
test: /\.scss$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
options: {
publicPath: "",
},
},
"css-loader",
"sass-loader",
], // sass->css->style
},
{
test: /\.mp4$/,
use: "file-loader?name=videos/[name].[ext]",
},
],
},
optimization: {
minimizer: [new CssMinimizerPlugin()],
},
};