-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathwebpack.common.js
74 lines (73 loc) · 2.15 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
62
63
64
65
66
67
68
69
70
71
72
73
74
const CopyWebpackPlugin = require("copy-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const {VueLoaderPlugin} = require("vue-loader");
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = {
entry: {
"refresher.bundle.js": "./src/index.ts",
"background.js": "./src/root/background.ts",
"option.bundle.js": "./src/root/option.bundle.ts",
"./assets/js/alert_register.js": "./src/assets/js/alert_register.ts",
"./assets/js/alert_unregister.js": "./src/assets/js/alert_unregister.ts",
"./assets/js/grecaptcha.js": "./src/assets/js/grecaptcha.ts"
},
output: {
path: path.join(__dirname, "dist"),
filename: "[name]",
clean: true
},
module: {
rules: [
{
include: /src/,
test: /\.js|\.ts$/,
use: {
loader: "swc-loader"
}
},
{
include: /src/,
test: /\.s[ac]ss$/i,
use: [
MiniCssExtractPlugin.loader,
"css-loader",
"sass-loader"
]
},
{
include: /src/,
test: /\.vue$/,
use: {
loader: "vue-loader"
}
}
]
},
plugins: [
new MiniCssExtractPlugin({
filename: "refresher.bundle.css"
}),
new CopyWebpackPlugin({
patterns: [
{
from: "src/assets",
to: "assets/",
filter: async (resourcePath) => {
return !resourcePath.endsWith(".ts");
}
}
]
}),
new HtmlWebpackPlugin({
template: "./src/views/index.html",
filename: "views/index.html",
inject: false
}),
new VueLoaderPlugin()
],
resolve: {
extensions: [".js", ".ts", ".css", ".vue"],
modules: ["node_modules"]
}
};