-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
56 lines (51 loc) · 1.21 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
let path = require("path");
let webpack = require("webpack");
let CopyWebpackPlugin = require("copy-webpack-plugin");
let mode = "development";
if (process.env.PRODUCTION) mode = "production";
const copyPatterns = [
{from: "./googlepinyin/out/index.wasm", to: "."},
{from: "./src/asset", to: "."},
{from: "./src/manifests/manifest_decoder.json", to: "./manifest.json"}
];
module.exports = {
entry: {
background: "./src/chrome-extension.ts",
options: "./src/option.ts"
},
mode: mode,
output: {
path: path.resolve(process.cwd(), "./out"),
filename: '[name].js'
},
module: {
rules: [
{test: /\.ts$/, use: "ts-loader"}
]
},
devtool: "source-map",
resolve: {
extensions: [".ts", "..."],
alias: {
src: path.resolve(process.cwd(), "src"),
googlepinyin: path.resolve(process.cwd(), "googlepinyin")
},
fallback: {
"path": false,
"perf_hooks": false,
fs: false,
worker_threads: false,
crypto: false,
}
},
plugins: [
new webpack.DefinePlugin({
"process.env.CHROME_OS": true,
"process.env.WEB": false,
"process.env.CODE": false
}),
new CopyWebpackPlugin({
patterns: copyPatterns
})
]
}