-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathwebpack.crx.babel.ts
53 lines (50 loc) · 1.56 KB
/
webpack.crx.babel.ts
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
import path from "path";
import webpack, { Configuration } from "webpack";
import VueLoaderPlugin from "vue-loader/lib/plugin";
import { CleanWebpackPlugin } from "clean-webpack-plugin";
import CopyPlugin from "copy-webpack-plugin";
import rules from "./webpack.rules";
const config: Configuration = {
entry: {
main: "./src/main.ts",
inject: "./src/inject.ts",
content: "./src/content.ts",
background: "./src/background.ts",
},
output: {
path: path.resolve(__dirname, "./dist"),
filename: `[name].js`,
},
module: {
rules: rules,
},
plugins: [
// 使用webpack打包vue文件,必须需要这个插件
new VueLoaderPlugin(),
new CleanWebpackPlugin({ cleanStaleWebpackAssets: false }),
new webpack.optimize.LimitChunkCountPlugin({
maxChunks: 1,
}),
new CopyPlugin({
patterns: [
{ from: "manifest.json", to: "" },
{ from: "assets/icon.png", to: "" },
],
}),
new webpack.EnvironmentPlugin({
CRX: true,
LITE: false,
}),
],
resolve: {
//import的时候,可以不用写扩展名
extensions: [".ts", ".js", ".vue", ".json"],
alias: {
"@src": path.resolve(__dirname, "./src/"),
"@utils": path.resolve(__dirname, "./src/utils/"),
"@assets": path.resolve(__dirname, "./assets/"),
"@plugins": path.resolve(__dirname, "./src/plugins/"),
},
},
};
export default config;