This repository has been archived by the owner on Apr 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
91 lines (81 loc) · 2.36 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
88
89
90
91
const path = require("path");
const { DefinePlugin } = require("webpack");
const HTMLWebpackPlugin = require("html-webpack-plugin");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const BCUPUI_ICONS_PATH = path.join(path.dirname(require.resolve("@buttercup/ui")), "icons");
const pkgInfo = require("./package.json");
const bcupCoreInfo = require("buttercup/package.json");
module.exports = [{
devtool: false,
entry: path.resolve(__dirname, "./source/renderer/index.tsx"),
module: {
rules: [
{
test: /\.tsx?$/,
use: [{
loader: "ts-loader",
options: {
configFile: path.resolve(__dirname, "./tsconfig.web.json")
}
}],
exclude: /node_modules/
},
{
test: /\.pug$/,
use: "pug-loader"
},
{
test: /\.(png|jpe?g|gif)$/i,
use: "file-loader"
},
{
test: /\.(ttf|otf|woff|woff2|eot)$/i,
use: "file-loader"
},
{
test: /\.css$/i,
use: ["style-loader", "css-loader"]
},
{
test: /\.s[ac]ss$/i,
use: [
"style-loader",
"css-loader",
"sass-loader",
]
}
]
},
output: {
filename: "index.js",
path: path.resolve(__dirname, "./build/renderer")
},
plugins: [
new HTMLWebpackPlugin({
filename: "index.html",
inject: "body",
template: path.resolve(__dirname, "./resources/renderer.pug")
}),
new CopyWebpackPlugin({
patterns: [{
from: BCUPUI_ICONS_PATH,
to: "icons"
}]
}),
new DefinePlugin({
__CORE_VERSION__: JSON.stringify(bcupCoreInfo.version),
__VERSION__: JSON.stringify(pkgInfo.version)
})
],
resolve: {
alias: {
buttercup: require.resolve("buttercup/web")
},
extensions: [".tsx", ".ts", ".js"]
},
target: "electron-renderer",
watchOptions: {
poll: 1000,
ignored: /node_modules/
}
}];