-
Notifications
You must be signed in to change notification settings - Fork 9
/
webpack.common.js
41 lines (41 loc) · 1.26 KB
/
webpack.common.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
const path = require("path");
module.exports = {
mode: "development",
entry: "./src/app/App.tsx",
devtool: "inline-source-map",
target: "electron-renderer",
module: {
rules: [{
// Turn all our .tsx into .js files
test: /\.tsx$/,
exclude: /node_modules/,
use: [{
// Compile .tsx -> .js (with JSX) -> Plain .js
loader: "babel-loader",
options: {
presets: [
"@babel/preset-typescript", [
"@babel/preset-env", {
targets: {
esmodules: true
}
}],
"@babel/preset-react"]
}
}]
},{
test: /\.css$/,
use: ["style-loader", "css-loader", "postcss-loader"]
},{
test: /\.(png|svg|jpg|jpeg|gif)$/i,
use: "file-loader"
}]
},
resolve: { // Resolve any .js or .tsx modules referenced in index.tsx and encountered files
extensions: [".js", ".tsx", ".css"]
},
output: { // Output to /build/app/app.js
filename: "app.js",
path: path.resolve(__dirname, "build", "app")
}
}