-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
95 lines (94 loc) · 2.29 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
/* eslint-disable @typescript-eslint/no-require-imports */
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require("path");
const webpack = require("webpack");
const HtmlWebPackPlugin = require("html-webpack-plugin");
const CopyPlugin = require("copy-webpack-plugin");
module.exports = {
mode: "development",
entry: {
app: "./src/index.ts",
"editor.worker": "monaco-editor/esm/vs/editor/editor.worker.js",
/*
"json.worker": "monaco-editor/esm/vs/language/json/json.worker",
"ts.worker": "monaco-editor/esm/vs/language/typescript/ts.worker",
*/
},
experiments: {
topLevelAwait: true
},
devServer: {
open: true,
hot: true,
},
resolve: {
fallback: {
"./%23ui2%23cl_json.clas.mjs": false,
"buffer": require.resolve("buffer/"),
"assert": false,
"stream": require.resolve("stream-browserify"),
"crypto": false,
"path": require.resolve("path-browserify"),
"fs": false,
"http": false,
"https": false,
"process": require.resolve("process"),
"zlib": require.resolve("browserify-zlib"),
"tls": false,
"net": false,
"util": false,
"url": false,
"string_decoder": require.resolve("string_decoder/"),
},
extensions: [".ts", ".js", ".mjs"],
},
output: {
globalObject: "self",
filename: "[name].bundle.js",
path: path.resolve(__dirname, "dist"),
},
module: {
rules: [
{
test: /\.ts?$/,
use: "ts-loader",
exclude: /node_modules/,
},
{
test: /\.css$/,
use: ["style-loader", "css-loader"],
},
{
test: /\.png$/,
include: /favicon/,
use: "file-loader?name=[name].[ext]",
},
{
test: /\.png$|\.svg$/,
exclude: /favicon/,
use: "url-loader?limit=1024",
},
{
test: /\.ttf$/,
type: "asset/resource",
generator: {
filename: "[name][ext]",
},
},
],
},
plugins: [
new HtmlWebPackPlugin({
template: "public/index.html",
}),
new webpack.ProvidePlugin({
Buffer: ["buffer", "Buffer"],
process: 'process/browser',
}),
new CopyPlugin({
patterns: [
{ from: "./public/*.xlsx", to: "[name].xlsx" },
],
}),
],
};