-
Notifications
You must be signed in to change notification settings - Fork 103
/
Copy pathwebpack.config.ts
82 lines (80 loc) · 2.58 KB
/
webpack.config.ts
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
import { fileURLToPath } from "url";
import path from "path";
import autoprefixer from "autoprefixer";
import assetPath from "./src/services/asset_path.js";
import miniCssExtractPlugin from "mini-css-extract-plugin";
import type { Configuration } from "webpack";
const rootDir = path.dirname(fileURLToPath(import.meta.url));
const config: Configuration = {
mode: "production",
entry: {
setup: "./src/public/app/setup.js",
login: "./src/public/app/login.js",
mobile: "./src/public/app/mobile.js",
desktop: "./src/public/app/desktop.js",
share: "./src/public/app/share.js",
// TriliumNextTODO: integrate set_password into setup entry point/view
set_password: "./src/public/app/set_password.js"
},
output: {
publicPath: `${assetPath}/app-dist/`,
path: path.resolve(rootDir, "src/public/app-dist"),
filename: "[name].js"
},
plugins: [
new miniCssExtractPlugin({
// TriliumNextTODO: enable this, once webpack build outputs into the "build" folder, instead of "src/public/app-dist" folder => @pano9000
//filename: "../stylesheets/[name].css"
})
],
module: {
rules: [
{
test: /\.ts$/,
use: [
{
loader: "ts-loader",
options: {
configFile: path.join(rootDir, "tsconfig.webpack.json")
}
}
],
exclude: /node_modules/
},
{
// bootstrap CSS related configuration
test: /\.(scss)$/,
use: [
{
loader: miniCssExtractPlugin.loader
},
{
loader: "css-loader"
},
{
loader: "postcss-loader",
options: {
postcssOptions: {
plugins: [autoprefixer]
}
}
},
{
loader: "sass-loader"
}
]
}
]
},
resolve: {
extensions: [".ts", ".js"],
extensionAlias: {
".js": [".js", ".ts"],
".cjs": [".cjs", ".cts"],
".mjs": [".mjs", ".mts"]
}
},
devtool: "source-map",
target: "electron-renderer"
};
export default config;