forked from buttercup/buttercup-desktop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
105 lines (95 loc) · 3.16 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
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 BCUP_PACKAGE_PATH = path.join(__dirname, "node_modules/buttercup/package.json");
const pkgInfo = require("./package.json");
const bcupCoreInfo = require(BCUP_PACKAGE_PATH);
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",
{
loader: "sass-loader",
options: {
implementation: require("sass")
}
}
]
}
]
},
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"),
"react-dnd": path.resolve("node_modules/react-dnd"),
"react/jsx-runtime": "react/jsx-runtime.js"
},
extensions: [".tsx", ".ts", ".js"]
},
target: "electron-renderer",
watchOptions: {
poll: 1000,
ignored: /node_modules/
}
}
];