-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
executable file
·87 lines (84 loc) · 1.86 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
const webpack = require("webpack");
const CopyPlugin = require("copy-webpack-plugin");
const AppPath = __dirname + "/app/";
const DistPath = __dirname + "/build/";
module.exports = {
mode: "production",
//mode: "development",
entry: {
inject: __dirname + "/app/inject/inject.js",
background: __dirname + "/app/background/background.js",
option: __dirname + "/app/option/option.js"
},
output: {
path: __dirname + "/app/dist",
filename: "[name].entry.js"
},
module: {
rules: [
{
test: /\.vue$/,
loader: "vue-loader"
},
{
test: /\.svg$/,
loader: "svg-inline-loader"
},
{
test: /\.html$/,
loader: "html-loader"
},
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
},
{
test: /\.(css)$/,
use: [
{
loader: "style-loader" // creates style nodes from JS strings
},
{
loader: "css-loader" // translates CSS into CommonJS
}
]
},
{
test: /\.(woff|woff2|eot|ttf|png|svg|gif)(\?.*$|$)/,
loader: "url-loader?importLoaders=1&limit=100000"
}
]
},
resolve: {
extensions: [".js", ".vue"],
alias: {
vue$: "vue/dist/vue.esm.js"
}
},
plugins: [
new webpack.BannerPlugin("Copyright banther@pm.me"),
new CopyPlugin([{ from: AppPath + "manifest.json", to: DistPath }]),
new CopyPlugin([
{
from: AppPath + "dist/*.entry.js",
to: DistPath + "dist/",
flatten: true
}
]),
new CopyPlugin([
{
from: AppPath + "assets",
to: DistPath + "assets"
}
]),
new CopyPlugin([
{
from: AppPath + "option/index.html",
to: DistPath + "option/index.html"
}
]),
]
};