-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathwebpack.config.js
89 lines (86 loc) · 2.81 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
/*
* OMFrontend.js
* Copyright (C) 2022 Perpetual Labs, Ltd.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import CopyPlugin from "copy-webpack-plugin";
import ResolveTypeScriptPlugin from "resolve-typescript-plugin";
import { dirname, join, resolve } from "path";
import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
export default (env, argv) => {
return {
mode: "development",
entry: {
OMFrontend: "./src/browser/index.ts",
"editor.worker": "monaco-editor-core/esm/vs/editor/editor.worker.js",
"json.worker": "monaco-editor/esm/vs/language/json/json.worker"
},
target: "web",
output: {
filename: "[name].js",
globalObject: "self",
path: resolve(__dirname, "./dist")
},
module: {
rules: [
{
test: /\.tsx?$/,
use: "ts-loader",
exclude: /node_modules/,
}
]
},
resolve: {
extensions: [".js", ".ts"],
fallback: {
assert: false,
child_process: false,
fs: false,
http: false,
https: false,
net: false,
os: false,
path: false,
process: false,
stream: false,
tls: false,
url: false,
util: false,
zlib: false
},
modules: [
join(__dirname, "./node_modules"),
],
plugins: [
new ResolveTypeScriptPlugin()
]
},
plugins: [
new CopyPlugin({
patterns: [
{ from: "./node_modules/web-tree-sitter/tree-sitter.wasm", to: "./" },
{ from: "./node_modules/tree-sitter-modelica/tree-sitter-modelica.wasm", to: "./" },
],
})
],
performance: {
hints: false,
maxEntrypointSize: 512000,
maxAssetSize: 512000
}
}
};