-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
136 lines (134 loc) · 4.07 KB
/
webpack.config.js
File metadata and controls
136 lines (134 loc) · 4.07 KB
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
const path = require("path");
const CircularDependencyPlugin = require("circular-dependency-plugin");
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
const trustHttpServer = require("./server/trust-login");
const corporateHttpServer = require("./server/corporate");
const businessHttpServer = require("./server/business");
const { router: activeManagerHttpServer } = require("./server/active-manager");
const externalMenuHttpServer = require("./server/external-menu");
const notificationsHttpServer = require("./server/notifications");
const externalHttpServer = require("./server/external");
const dbSource = require("./server/db-source");
const messageHttpServer = require("./server/messages");
const widgetList = require("./server/widget-list");
module.exports = (env, options) => {
return {
entry: {
basispanel: {
import: "./src/ComponentLoader.ts",
filename: "basiscore.basispanel.component.js",
library: {
name: "basispanel",
type: "assign",
},
},
"basispanel.min": {
import: "./src/ComponentLoader.ts",
filename: "basiscore.basispanel.component.min.js",
library: {
name: "basispanel",
type: "assign",
},
},
},
externals: {
basiscore: "basiscore",
},
devServer: {
static: [
{
directory: path.resolve(__dirname, "wwwroot"),
},
{
directory: path.resolve(__dirname, "node_modules/alasql/dist"),
},
{
directory: path.resolve(__dirname, "node_modules/basiscore/dist"),
},
],
onBeforeSetupMiddleware: function (server) {
server.app.use("/server/trust", trustHttpServer);
server.app.use("/server/messages", messageHttpServer);
server.app.use("/server/corporate", corporateHttpServer);
server.app.use("/server/business", businessHttpServer);
server.app.use("/server/active", activeManagerHttpServer);
server.app.use("/server/external", externalMenuHttpServer);
server.app.use("/server/notifications", notificationsHttpServer);
server.app.use("/server/external", externalHttpServer);
server.app.use("/server/dbsource", dbSource);
server.app.use("/server/widget-list", widgetList);
},
open: true,
port: 8080,
},
mode: options.mode,
optimization: {
minimize: options.mode === "production",
minimizer: [
new UglifyJsPlugin({
include: /\.min\.js$/,
}),
],
},
module: {
rules: [
{
test: /\.ts$/i,
use: ["ts-loader"],
},
{
test: /\.css$/i,
use: ["style-loader", "css-loader"],
},
{
test: /\.png$/i,
type: "asset/inline",
},
{
test: /\.html$/i,
type: "asset/source",
},
{
test: /\.svg$/i,
type: "asset/inline",
},
{
test: /\.(jpe?g)$/,
type: "asset/inline",
},
],
},
resolve: {
extensions: [
".ts",
".tsx",
".js",
".jsx",
".css",
".png",
".html",
".svg",
".jpg",
".jpeg",
], // there's a dot missing
},
plugins: [
new CircularDependencyPlugin({
// `onStart` is called before the cycle detection starts
onStart({ compilation }) {
console.log("start detecting webpack modules cycles");
},
// `onDetected` is called for each module that is cyclical
onDetected({ module: webpackModuleRecord, paths, compilation }) {
// `paths` will be an Array of the relative module paths that make up the cycle
// `module` will be the module record generated by webpack that caused the cycle
compilation.errors.push(new Error(paths.join(" -> ")));
},
// `onEnd` is called before the cycle detection ends
onEnd({ compilation }) {
console.log("end detecting webpack modules cycles");
},
}),
],
};
};