-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathwebpack.common.js
More file actions
101 lines (100 loc) · 2.98 KB
/
webpack.common.js
File metadata and controls
101 lines (100 loc) · 2.98 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
const path = require("path");
const APP = path.resolve(__dirname);
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const CopyPlugin = require("copy-webpack-plugin");
module.exports = {
context: APP,
entry: {
app: path.join(APP, "index.js"),
sailsio: path.join(APP, "init", "sailsIo.js"),
},
output: {
path: path.join(APP, "..", "web", "assets"),
filename: "[name].[contenthash].js",
publicPath: "/assets/",
},
module: {
rules: [
{
test: /\.(eot|woff|woff2|svg|ttf)([?]?.*)$/,
use: ["url-loader?limit=10000000"],
},
{
test: /\.js$/,
enforce: "pre",
use: ["source-map-loader"],
},
],
},
plugins: [
new CleanWebpackPlugin({
cleanOnceBeforeBuildPatterns: [
"*.js",
"*.js.map",
"*.gz",
"*.LICENSE.txt",
],
}),
new CopyPlugin({
patterns: [
{
from: path.join(APP, "node_modules", "tinymce", "models", "dom", "model.js"),
to: "models/dom/model.js",
noErrorOnMissing: true,
},
],
}),
],
resolve: {
alias: {
assets: path.resolve(__dirname, "..", "web", "assets"),
},
},
optimization: {
moduleIds: "deterministic",
runtimeChunk: "single",
splitChunks: {
cacheGroups: {
vendors: false,
default: false,
pdfjs: {
test: /[\\/]node_modules[\\/]pdfjs-dist|[\\/]AppBuilder[\\/]platform[\\/]plugins[\\/]included[\\/]view_pdfImporter[\\/]pdfjs/,
filename: "pdfjs.[name].[contenthash].mjs",
chunks: "all",
reuseExistingChunk: true,
priority: 10,
},
formio: {
test: /[\\/]node_modules[\\/](?:formiojs|bootstrap)|[\\/]init[\\/]formio/,
filename: "formio.[name].[contenthash].js",
chunks: "all",
reuseExistingChunk: true,
priority: 10,
},
tinymce: {
test: /[\\/]node_modules[\\/]tinymce|[\\/]js[\\/]webix[\\/]extras[\\/]tinymce/,
filename: "tinymce.[name].[contenthash].js",
chunks: "all",
reuseExistingChunk: true,
priority: 10,
},
vendor: {
test: /[\\/]node_modules[\\/](?!pdfjs-dist)(?!formiojs)(?!bootstrap)(?!tinymce)/,
filename: "vendor.[name].[contenthash].js",
chunks: "all",
reuseExistingChunk: true,
},
orgchart: {
test: /[\\/]js[\\/]orgchart-webcomponents.js/,
filename: "orgchart.[name].[contenthash].js",
chunks: "all",
reuseExistingChunk: true,
priority: 10,
},
},
},
},
experiments: {
topLevelAwait: true,
},
};