-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
43 lines (39 loc) · 1.01 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
const path = require("path");
const MonacoWebpackPlugin = require("monaco-editor-webpack-plugin");
const isDev = process.env.NODE_ENV === "development";
const BUILD_DIR = isDev
? path.resolve(__dirname, "resources", "public", "js")
: path.resolve(__dirname, "prod", "js");
const APP_DIR = path.resolve(__dirname, "src", "js");
const config = {
mode: "production",
entry: `${APP_DIR}/main.js`,
module: {
rules: [
{
test: /\.css$/,
use: ["style-loader", "css-loader"],
},
{
test: /\.ttf$/,
type: "asset/resource",
},
],
},
plugins: [
new MonacoWebpackPlugin({
languages: ["clojure"],
filename: isDev ? "[name].worker.js" : "[name].[contenthash].worker.js",
}),
],
output: {
path: BUILD_DIR,
filename: (data) => {
if (data.chunk.name === "main") {
return isDev ? "deps.js" : "deps.[contenthash].js";
}
return isDev ? "[name].js" : "[name].[contenthash].js";
},
},
};
module.exports = config;