-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.common.js
61 lines (59 loc) · 1.75 KB
/
webpack.common.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
const TerserPlugin = require("terser-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin");
const path = require("path");
module.exports = {
entry: {
"main": "./src/main.ts",
"theme": "./src/theme.scss",
},
output: {
path: path.join(process.cwd(), "docs/assets"),
filename: "javascripts/[name].js"
},
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({}),
new OptimizeCSSAssetsPlugin({}),
],
},
performance: { hints: "warning" },
plugins: [
new MiniCssExtractPlugin({
filename: "stylesheets/[name].css",
chunkFilename: "stylesheets/[id].css",
}),
],
module: {
rules: [
{
test: /\.ts$/i,
exclude: /node_modules|venv|site/,
use: "ts-loader",
},
{
test: /\.(sa|sc|c)ss$/,
exclude: /node_modules|venv|site/,
use: [
MiniCssExtractPlugin.loader,
{ loader: "css-loader" },
{
loader: "sass-loader",
options: {
implementation: require("sass"),
webpackImporter: false,
sassOptions: {
includePaths: ["./node_modules"],
},
},
},
]
},
]
},
resolve: {
extensions: [".ts", ".js", ".scss"],
modules: ["node_modules"],
}
};