-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
62 lines (56 loc) · 1.54 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
const path = require("path");
const webpack = require("webpack");
const WebpackCopyPlugin = require("copy-webpack-plugin");
let mode = "development";
if ("PRODUCTION" in process.env) mode = "production";
function getDefinePluginConfig() {
let data = {};
data["process.env.DEV"] = mode == "development" ? true : false;
return data;
}
module.exports = {
entry: {
background: './src/chromeosV3.main.ts',
"web/index": "./src/web.main.ts",
"background-v2": "./src/pages/chromeosV2.main.ts",
options: "./src/pages/chromeosOptions.ts",
},
mode,
output: {
path: path.resolve(process.cwd(), "./dist"),
filename: '[name].js'
},
module: {
rules: [
{test: /\.ts$/i, use: "ts-loader"},
{test: /\.css$/i, use: [
{
loader: "css-loader",
options: {
exportType: "string"
}
}
]}
]
},
devtool: "source-map",
resolve: {
extensions: [".ts", "..."],
alias: {
src: path.resolve(process.cwd(), "src"),
},
},
plugins: [
new WebpackCopyPlugin({
patterns: [
{from: "./assets/manifest/chromeos-ui.json", to: "./manifest.json"},
{from: "./assets/html/options.html", to: "./options.html"},
{from: "./assets/html/index.html", to: "./web/index.html"},
{from: "./librime/out/worker", to: "./web/decoders"},
{from: "./librime/emscripten/asset/data", to: "./web/data"},
{from: "./assets/manifest/_headers", to: "./web"}
]
}),
new webpack.DefinePlugin(getDefinePluginConfig()),
],
}