-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
99 lines (98 loc) · 2.5 KB
/
Copy pathwebpack.config.js
File metadata and controls
99 lines (98 loc) · 2.5 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
const path = require("path");
const CircularDependencyPlugin = require("circular-dependency-plugin");
const CopyPlugin = require("copy-webpack-plugin");
module.exports = {
entry: {
watermark: {
import: "./src/loader.ts",
filename: "basiscore.watermark.js",
library: {
name: "[name]",
type: "assign",
},
},
watermarkComponent: {
import: "./src/BcComponentLoader.ts",
filename: "basiscore.watermark.component.js",
library: {
name: "bc",
type: "assign",
},
},
wmDemoData: {
import: "./src/DemoData.ts",
filename: "basiscore.watermark.demo-data.js",
library: {
name: "[name]",
type: "assign",
},
},
},
output: {
filename: "basiscore.[name].js",
},
devServer: {
static: path.resolve(__dirname, "wwwroot"),
open: true,
port: 3001,
},
// optimization: {
// splitChunks: {
// cacheGroups: {
// app: {
// test: /[\\/]app[\\/]/,
// name: "basiscore.watermark",
// chunks: "all",
// },
// boot: {
// test: /[\\/]src[\\/]loader.ts$/,
// name: "basiscore.watermark.loader",
// chunks: "all",
// },
// },
// },
// },
module: {
rules: [
{
test: /\.ts$/,
use: ["ts-loader"],
},
{
test: /\.css$/,
use: ["style-loader", "css-loader"],
},
],
},
resolve: {
extensions: [".ts", ".tsx", ".js", ".jsx", ".css"], // 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");
},
}),
new CopyPlugin({
patterns: [
{
from: path.resolve(
__dirname,
"node_modules/jquery/dist/jquery.min.js"
),
},
],
}),
],
};