@elliemae/pui-cli 6.0.0-beta.9 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/lib/cli-commands/build.js +11 -5
- package/lib/cli-commands/pack.js +18 -78
- package/lib/cli-commands/test.js +1 -12
- package/lib/cli-commands/tsc.js +103 -0
- package/lib/cli-commands/utils.js +9 -4
- package/lib/cli-commands/vitest.js +66 -0
- package/lib/cli.js +2 -0
- package/lib/index.js +3 -1
- package/lib/lint/eslint/common.js +16 -8
- package/lib/lint/eslint/typescript/common.js +6 -1
- package/lib/lint/eslint/typescript/non-react.js +1 -1
- package/lib/lint/eslint/typescript/react.js +6 -1
- package/lib/lint/lint-staged.config.js +8 -1
- package/lib/lint/stylelint.config.js +0 -1
- package/lib/pui-config/index.js +18 -0
- package/lib/server/index.js +0 -7
- package/lib/server/middlewares/addDevMiddlewares.js +2 -2
- package/lib/server/middlewares/addProdMiddlewares.js +10 -3
- package/lib/testing/jest.config.js +18 -8
- package/lib/testing/jest.node.config.js +8 -0
- package/lib/testing/mocks/matchMedia.js +12 -6
- package/lib/testing/mocks/pui-app-loader.js +1 -3
- package/lib/testing/mocks/pui-diagnostics.js +27 -35
- package/lib/testing/mocks/pui-user-monitoring.js +3 -5
- package/lib/testing/mocks/retry-axios.js +3 -5
- package/lib/testing/mocks/webpack-hmr.js +1 -0
- package/lib/testing/resolver.js +47 -0
- package/lib/testing/setup-react-env.js +3 -0
- package/lib/testing/setup-tests.js +28 -4
- package/lib/testing/vitest.config.ts +16 -0
- package/lib/testing/vitest.setup.ts +0 -0
- package/lib/transpile/.swcrc +11 -0
- package/lib/transpile/esbuild.js +116 -0
- package/lib/transpile/react-shim.js +2 -0
- package/lib/transpile/swcrc.config.js +13 -0
- package/lib/typescript/tsc-files/index.js +66 -0
- package/lib/typescript/tsc-files/utils.js +16 -0
- package/lib/webpack/helpers.js +44 -3
- package/lib/webpack/webpack.base.babel.js +44 -71
- package/lib/webpack/webpack.dev.babel.js +16 -10
- package/lib/webpack/webpack.lib.base.babel.js +31 -46
- package/lib/webpack/webpack.lib.dev.babel.js +2 -3
- package/lib/webpack/webpack.lib.prod.babel.js +5 -11
- package/lib/webpack/webpack.prod.babel.js +29 -24
- package/lib/webpack/webpack.storybook.js +16 -88
- package/package.json +116 -124
- package/lib/esbuild.js +0 -44
- package/lib/testing/setup-styled-components-tests.js +0 -1
|
@@ -4,10 +4,11 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
|
4
4
|
const PostcssPresetEnv = require('postcss-preset-env');
|
|
5
5
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
6
6
|
const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin');
|
|
7
|
-
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
|
|
8
7
|
const MomentLocalesPlugin = require('moment-locales-webpack-plugin');
|
|
9
8
|
const { WebpackManifestPlugin } = require('webpack-manifest-plugin');
|
|
10
|
-
const
|
|
9
|
+
const FaviconsWebpackPlugin = require('favicons-webpack-plugin');
|
|
10
|
+
const { ProvidePlugin, ProgressPlugin } = require('webpack');
|
|
11
|
+
const browserslistToEsbuild = require('browserslist-to-esbuild');
|
|
11
12
|
|
|
12
13
|
const {
|
|
13
14
|
excludeNodeModulesExcept,
|
|
@@ -15,10 +16,9 @@ const {
|
|
|
15
16
|
modulesToTranspile,
|
|
16
17
|
getAlias,
|
|
17
18
|
getPaths,
|
|
19
|
+
filterByFilePresence,
|
|
18
20
|
} = require('./helpers');
|
|
19
|
-
const { ESBUILD_TARGET } = require('../esbuild');
|
|
20
21
|
|
|
21
|
-
// get the application configuration
|
|
22
22
|
const minicssLoader = {
|
|
23
23
|
loader: MiniCssExtractPlugin.loader,
|
|
24
24
|
options: {},
|
|
@@ -31,9 +31,6 @@ const postcssPlugins = [PostcssPresetEnv({ autoprefixer: { grid: true } })];
|
|
|
31
31
|
const { buildPath, publicPath } = getPaths();
|
|
32
32
|
|
|
33
33
|
const plugins = [
|
|
34
|
-
// Always expose NODE_ENV to webpack, in order to use `process.env.NODE_ENV`
|
|
35
|
-
// inside your code for any environment checks; Terser will automatically
|
|
36
|
-
// drop any unreachable code.
|
|
37
34
|
new webpack.EnvironmentPlugin({
|
|
38
35
|
NODE_ENV: 'development',
|
|
39
36
|
ASSET_PATH: '/',
|
|
@@ -43,13 +40,11 @@ const plugins = [
|
|
|
43
40
|
new webpack.DefinePlugin({
|
|
44
41
|
APP_CONFIG: getAppConfig(),
|
|
45
42
|
}),
|
|
46
|
-
new CaseSensitivePathsPlugin(),
|
|
47
|
-
// new ESLintPlugin(),
|
|
48
43
|
new ProvidePlugin({
|
|
49
44
|
React: 'react',
|
|
50
45
|
}),
|
|
51
46
|
new CopyWebpackPlugin({
|
|
52
|
-
patterns: [
|
|
47
|
+
patterns: filterByFilePresence([
|
|
53
48
|
{
|
|
54
49
|
from: 'app/app.config.json',
|
|
55
50
|
to: 'app.config.json',
|
|
@@ -93,17 +88,35 @@ const plugins = [
|
|
|
93
88
|
{
|
|
94
89
|
from: 'public',
|
|
95
90
|
noErrorOnMissing: true,
|
|
91
|
+
globOptions: {
|
|
92
|
+
ignore: ['readme.md'],
|
|
93
|
+
},
|
|
96
94
|
},
|
|
97
95
|
{
|
|
98
96
|
from: 'webroot',
|
|
99
97
|
to: '../',
|
|
100
98
|
noErrorOnMissing: true,
|
|
99
|
+
globOptions: {
|
|
100
|
+
ignore: ['readme.md'],
|
|
101
|
+
},
|
|
101
102
|
},
|
|
102
|
-
],
|
|
103
|
+
]),
|
|
103
104
|
}),
|
|
104
105
|
new DuplicatePackageCheckerPlugin(),
|
|
105
|
-
new MomentLocalesPlugin(),
|
|
106
|
+
new MomentLocalesPlugin({ localesToKeep: ['es-us'] }),
|
|
106
107
|
new WebpackManifestPlugin(),
|
|
108
|
+
new FaviconsWebpackPlugin({
|
|
109
|
+
logo: './app/view/images/favicon.png',
|
|
110
|
+
favicons: {
|
|
111
|
+
developerName: 'ICE MT',
|
|
112
|
+
developerURL: null, // prevent retrieving from the nearest package.json
|
|
113
|
+
icons: {
|
|
114
|
+
coast: false,
|
|
115
|
+
yandex: false,
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
}),
|
|
119
|
+
new ProgressPlugin(),
|
|
107
120
|
];
|
|
108
121
|
|
|
109
122
|
module.exports = (options) => ({
|
|
@@ -111,7 +124,6 @@ module.exports = (options) => ({
|
|
|
111
124
|
entry: options.entry,
|
|
112
125
|
output: {
|
|
113
126
|
clean: true,
|
|
114
|
-
// Compile into js/build.js
|
|
115
127
|
path: buildPath,
|
|
116
128
|
publicPath,
|
|
117
129
|
...options.output,
|
|
@@ -120,39 +132,7 @@ module.exports = (options) => ({
|
|
|
120
132
|
module: {
|
|
121
133
|
rules: [
|
|
122
134
|
{
|
|
123
|
-
test: /\.
|
|
124
|
-
use: [
|
|
125
|
-
'file-loader',
|
|
126
|
-
{
|
|
127
|
-
loader: 'image-webpack-loader',
|
|
128
|
-
options: {
|
|
129
|
-
gifsicle: {
|
|
130
|
-
enabled: false,
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
},
|
|
134
|
-
],
|
|
135
|
-
enforce: 'pre',
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
test: /\.(js|ts|jsx|tsx)$/,
|
|
139
|
-
enforce: 'pre',
|
|
140
|
-
exclude: /node_modules/,
|
|
141
|
-
resolve: {
|
|
142
|
-
fullySpecified: false,
|
|
143
|
-
},
|
|
144
|
-
use: [
|
|
145
|
-
{
|
|
146
|
-
loader: 'webpack-strip-block',
|
|
147
|
-
options: {
|
|
148
|
-
start: 'TEST:START',
|
|
149
|
-
end: 'TEST:END',
|
|
150
|
-
},
|
|
151
|
-
},
|
|
152
|
-
],
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
test: /\.(js|jsx)$/,
|
|
135
|
+
test: /\.jsx?$/,
|
|
156
136
|
exclude: excludeNodeModulesExcept(modulesToTranspile),
|
|
157
137
|
resolve: {
|
|
158
138
|
fullySpecified: false,
|
|
@@ -161,12 +141,12 @@ module.exports = (options) => ({
|
|
|
161
141
|
loader: 'esbuild-loader',
|
|
162
142
|
options: {
|
|
163
143
|
loader: 'jsx',
|
|
164
|
-
target:
|
|
144
|
+
target: browserslistToEsbuild(),
|
|
165
145
|
},
|
|
166
146
|
},
|
|
167
147
|
},
|
|
168
148
|
{
|
|
169
|
-
test: /\.
|
|
149
|
+
test: /\.tsx?$/,
|
|
170
150
|
exclude: excludeNodeModulesExcept(modulesToTranspile),
|
|
171
151
|
resolve: {
|
|
172
152
|
fullySpecified: false,
|
|
@@ -175,12 +155,15 @@ module.exports = (options) => ({
|
|
|
175
155
|
loader: 'esbuild-loader',
|
|
176
156
|
options: {
|
|
177
157
|
loader: 'tsx',
|
|
178
|
-
target:
|
|
158
|
+
target: browserslistToEsbuild(),
|
|
179
159
|
},
|
|
180
160
|
},
|
|
181
161
|
},
|
|
182
162
|
{
|
|
183
163
|
test: /\.css$/,
|
|
164
|
+
exclude: excludeNodeModulesExcept(
|
|
165
|
+
modulesToTranspile.concat(['sanitize.css']),
|
|
166
|
+
),
|
|
184
167
|
use: [
|
|
185
168
|
finalCSSLoader(options.mode),
|
|
186
169
|
{
|
|
@@ -190,13 +173,6 @@ module.exports = (options) => ({
|
|
|
190
173
|
sourceMap: true,
|
|
191
174
|
},
|
|
192
175
|
},
|
|
193
|
-
{
|
|
194
|
-
loader: 'esbuild-loader',
|
|
195
|
-
options: {
|
|
196
|
-
loader: 'css',
|
|
197
|
-
minify: options.mode === 'production',
|
|
198
|
-
},
|
|
199
|
-
},
|
|
200
176
|
{
|
|
201
177
|
loader: 'postcss-loader',
|
|
202
178
|
options: {
|
|
@@ -210,41 +186,39 @@ module.exports = (options) => ({
|
|
|
210
186
|
},
|
|
211
187
|
{
|
|
212
188
|
test: /\.(woff|woff2)$/,
|
|
213
|
-
exclude: excludeNodeModulesExcept(['@elliemae/*']),
|
|
214
189
|
type: 'asset/resource',
|
|
215
|
-
|
|
216
|
-
{
|
|
217
|
-
type: 'asset',
|
|
218
|
-
resourceQuery: /url/, // *.svg?react
|
|
190
|
+
exclude: excludeNodeModulesExcept(modulesToTranspile),
|
|
219
191
|
},
|
|
220
192
|
{
|
|
221
193
|
test: /\.svg$/i,
|
|
222
194
|
issuer: /\.[jt]sx?$/,
|
|
195
|
+
resourceQuery: /^((?!url).)*$/,
|
|
196
|
+
exclude: excludeNodeModulesExcept(modulesToTranspile),
|
|
223
197
|
use: ['@svgr/webpack'],
|
|
224
198
|
},
|
|
225
199
|
{
|
|
226
|
-
test: /\.(jpe?g|png|gif|ico)$/i,
|
|
227
|
-
exclude: excludeNodeModulesExcept(
|
|
228
|
-
type: 'asset',
|
|
229
|
-
},
|
|
230
|
-
{
|
|
231
|
-
test: /\.(mp4|webm)$/,
|
|
232
|
-
exclude: excludeNodeModulesExcept(['@elliemae/*']),
|
|
200
|
+
test: /\.(jpe?g|png|gif|ico|mp4|webm)$/i,
|
|
201
|
+
exclude: excludeNodeModulesExcept(modulesToTranspile),
|
|
233
202
|
type: 'asset',
|
|
234
203
|
},
|
|
235
204
|
{
|
|
236
205
|
resourceQuery: /resource/,
|
|
237
206
|
type: 'asset/resource',
|
|
207
|
+
exclude: excludeNodeModulesExcept(modulesToTranspile),
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
type: 'asset',
|
|
211
|
+
resourceQuery: /url/,
|
|
212
|
+
exclude: excludeNodeModulesExcept(modulesToTranspile),
|
|
238
213
|
},
|
|
239
214
|
],
|
|
240
215
|
},
|
|
241
216
|
plugins: plugins.concat(options.plugins),
|
|
242
217
|
resolve: {
|
|
243
218
|
modules: ['node_modules', 'app', 'lib'],
|
|
244
|
-
extensions: ['.
|
|
219
|
+
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json', '.wasm', '.mjs'],
|
|
245
220
|
mainFields: ['browser', 'module', 'main'],
|
|
246
221
|
alias: {
|
|
247
|
-
'lodash-es': 'lodash',
|
|
248
222
|
...getAlias(),
|
|
249
223
|
...((options.resolve || {}).alias || {}),
|
|
250
224
|
},
|
|
@@ -255,6 +229,5 @@ module.exports = (options) => ({
|
|
|
255
229
|
'@elliemae/pui-diagnostics': 'emuiDiagnostics',
|
|
256
230
|
},
|
|
257
231
|
devtool: options.devtool || 'eval-source-map',
|
|
258
|
-
target: 'web', // Make web variables accessible to webpack, e.g. window
|
|
259
232
|
performance: options.performance || {},
|
|
260
233
|
});
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
|
-
const
|
|
2
|
+
const { HotModuleReplacementPlugin } = require('webpack');
|
|
3
3
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
4
4
|
const CircularDependencyPlugin = require('circular-dependency-plugin');
|
|
5
5
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
6
6
|
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
|
|
7
|
+
const SpeedMeasurePlugin = require('speed-measure-webpack-plugin');
|
|
8
|
+
|
|
9
|
+
const smp = new SpeedMeasurePlugin({ disable: !process.env.MEASURE });
|
|
7
10
|
|
|
8
11
|
const {
|
|
9
12
|
getAssetPath,
|
|
@@ -72,13 +75,8 @@ const devConfig = {
|
|
|
72
75
|
|
|
73
76
|
// Add development plugins
|
|
74
77
|
plugins: [
|
|
75
|
-
new webpack.HotModuleReplacementPlugin(), // Tell webpack we want hot reloading
|
|
76
|
-
new ReactRefreshWebpackPlugin({
|
|
77
|
-
overlay: {
|
|
78
|
-
sockIntegration: 'whm',
|
|
79
|
-
},
|
|
80
|
-
}),
|
|
81
78
|
new HtmlWebpackPlugin({
|
|
79
|
+
scriptLoading: 'module',
|
|
82
80
|
inject: !isAppLoaderEnabled(), // Inject all files that are generated by webpack, e.g. bundle.js
|
|
83
81
|
template: !isAppLoaderEnabled()
|
|
84
82
|
? 'app/index.html'
|
|
@@ -105,8 +103,6 @@ const devConfig = {
|
|
|
105
103
|
}),
|
|
106
104
|
],
|
|
107
105
|
|
|
108
|
-
// Emit a source map for easier debugging
|
|
109
|
-
// See https://webpack.js.org/configuration/devtool/#devtool
|
|
110
106
|
devtool: 'eval-source-map',
|
|
111
107
|
|
|
112
108
|
performance: {
|
|
@@ -114,4 +110,14 @@ const devConfig = {
|
|
|
114
110
|
},
|
|
115
111
|
};
|
|
116
112
|
|
|
117
|
-
|
|
113
|
+
const config = smp.wrap(baseConfigFactory(devConfig));
|
|
114
|
+
config.plugins = config.plugins.concat([
|
|
115
|
+
new HotModuleReplacementPlugin(),
|
|
116
|
+
new ReactRefreshWebpackPlugin({
|
|
117
|
+
overlay: {
|
|
118
|
+
sockIntegration: 'whm',
|
|
119
|
+
},
|
|
120
|
+
}),
|
|
121
|
+
]);
|
|
122
|
+
|
|
123
|
+
module.exports = config;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
/* eslint-disable max-lines */
|
|
2
2
|
const path = require('path');
|
|
3
|
-
const
|
|
3
|
+
const { EnvironmentPlugin, DefinePlugin } = require('webpack');
|
|
4
4
|
const {
|
|
5
5
|
optimize: { LimitChunkCountPlugin },
|
|
6
|
+
ProgressPlugin,
|
|
6
7
|
} = require('webpack');
|
|
7
8
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
8
9
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
9
10
|
const PostcssPresetEnv = require('postcss-preset-env');
|
|
10
11
|
const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin');
|
|
11
|
-
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
|
|
12
12
|
const MomentLocalesPlugin = require('moment-locales-webpack-plugin');
|
|
13
|
+
const browserslistToEsbuild = require('browserslist-to-esbuild');
|
|
13
14
|
|
|
14
15
|
const {
|
|
15
16
|
excludeNodeModulesExcept,
|
|
@@ -18,8 +19,8 @@ const {
|
|
|
18
19
|
modulesToTranspile,
|
|
19
20
|
getAssetPath,
|
|
20
21
|
getAlias,
|
|
22
|
+
filterByFilePresence,
|
|
21
23
|
} = require('./helpers');
|
|
22
|
-
const { ESBUILD_TARGET } = require('../esbuild');
|
|
23
24
|
|
|
24
25
|
const minicssLoader = {
|
|
25
26
|
loader: MiniCssExtractPlugin.loader,
|
|
@@ -30,33 +31,33 @@ const finalCSSLoader = (mode) =>
|
|
|
30
31
|
mode !== 'production' ? { loader: 'style-loader' } : minicssLoader;
|
|
31
32
|
|
|
32
33
|
const plugins = [
|
|
33
|
-
new
|
|
34
|
+
new EnvironmentPlugin({
|
|
34
35
|
NODE_ENV: 'development',
|
|
35
36
|
ASSET_PATH: '/',
|
|
36
37
|
CI: 'false',
|
|
37
38
|
}),
|
|
38
|
-
new
|
|
39
|
+
new DefinePlugin({
|
|
39
40
|
APP_CONFIG: getAppConfig(true),
|
|
40
41
|
}),
|
|
41
|
-
new CaseSensitivePathsPlugin(),
|
|
42
42
|
new CopyWebpackPlugin({
|
|
43
|
-
patterns: [
|
|
43
|
+
patterns: filterByFilePresence([
|
|
44
44
|
{
|
|
45
45
|
from: 'lib/app.config.json',
|
|
46
46
|
to: 'app.config.json',
|
|
47
47
|
noErrorOnMissing: true,
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
|
-
from: '
|
|
50
|
+
from: 'lib/public',
|
|
51
51
|
noErrorOnMissing: true,
|
|
52
52
|
},
|
|
53
|
-
],
|
|
53
|
+
]),
|
|
54
54
|
}),
|
|
55
55
|
new DuplicatePackageCheckerPlugin(),
|
|
56
56
|
new LimitChunkCountPlugin({
|
|
57
57
|
maxChunks: 1,
|
|
58
58
|
}),
|
|
59
|
-
new MomentLocalesPlugin(),
|
|
59
|
+
new MomentLocalesPlugin({ localesToKeep: ['es-us'] }),
|
|
60
|
+
new ProgressPlugin(),
|
|
60
61
|
];
|
|
61
62
|
|
|
62
63
|
module.exports = (options) => ({
|
|
@@ -74,39 +75,21 @@ module.exports = (options) => ({
|
|
|
74
75
|
module: {
|
|
75
76
|
rules: [
|
|
76
77
|
{
|
|
77
|
-
test:
|
|
78
|
-
|
|
79
|
-
'file-loader',
|
|
80
|
-
{
|
|
81
|
-
loader: 'image-webpack-loader',
|
|
82
|
-
options: {
|
|
83
|
-
gifsicle: {
|
|
84
|
-
enabled: false,
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
],
|
|
89
|
-
enforce: 'pre',
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
test: /^(?!.*\.exec\.js$).*\.(js|ts|jsx|tsx)$/,
|
|
93
|
-
enforce: 'pre',
|
|
94
|
-
exclude: /node_modules/,
|
|
78
|
+
test: /^(?!.*\.exec\.js$).*\.jsx?$/, // Transform all .js and .jsx files with Babel
|
|
79
|
+
exclude: excludeNodeModulesExcept(modulesToTranspile),
|
|
95
80
|
resolve: {
|
|
96
81
|
fullySpecified: false,
|
|
97
82
|
},
|
|
98
|
-
use:
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
end: 'TEST:END',
|
|
104
|
-
},
|
|
83
|
+
use: {
|
|
84
|
+
loader: 'esbuild-loader',
|
|
85
|
+
options: {
|
|
86
|
+
loader: 'jsx',
|
|
87
|
+
target: browserslistToEsbuild(),
|
|
105
88
|
},
|
|
106
|
-
|
|
89
|
+
},
|
|
107
90
|
},
|
|
108
91
|
{
|
|
109
|
-
test: /^(?!.*\.exec\.js$).*\.
|
|
92
|
+
test: /^(?!.*\.exec\.js$).*\.tsx?$/, // Transform all .js and .jsx files with Babel
|
|
110
93
|
exclude: excludeNodeModulesExcept(modulesToTranspile),
|
|
111
94
|
resolve: {
|
|
112
95
|
fullySpecified: false,
|
|
@@ -114,8 +97,8 @@ module.exports = (options) => ({
|
|
|
114
97
|
use: {
|
|
115
98
|
loader: 'esbuild-loader',
|
|
116
99
|
options: {
|
|
117
|
-
loader: '
|
|
118
|
-
target:
|
|
100
|
+
loader: 'tsx',
|
|
101
|
+
target: browserslistToEsbuild(),
|
|
119
102
|
},
|
|
120
103
|
},
|
|
121
104
|
},
|
|
@@ -170,13 +153,11 @@ module.exports = (options) => ({
|
|
|
170
153
|
exclude: excludeNodeModulesExcept(['@elliemae/*']),
|
|
171
154
|
type: 'asset/resource',
|
|
172
155
|
},
|
|
173
|
-
{
|
|
174
|
-
type: 'asset',
|
|
175
|
-
resourceQuery: /url/, // *.svg?react
|
|
176
|
-
},
|
|
177
156
|
{
|
|
178
157
|
test: /\.svg$/i,
|
|
179
158
|
issuer: /\.[jt]sx?$/,
|
|
159
|
+
resourceQuery: /^((?!url).)*$/,
|
|
160
|
+
exclude: excludeNodeModulesExcept(['@elliemae/*']),
|
|
180
161
|
use: ['@svgr/webpack'],
|
|
181
162
|
},
|
|
182
163
|
{
|
|
@@ -197,16 +178,21 @@ module.exports = (options) => ({
|
|
|
197
178
|
{
|
|
198
179
|
resourceQuery: /resource/,
|
|
199
180
|
type: 'asset/resource',
|
|
181
|
+
exclude: excludeNodeModulesExcept(['@elliemae/*']),
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
type: 'asset',
|
|
185
|
+
resourceQuery: /url/,
|
|
186
|
+
exclude: excludeNodeModulesExcept(['@elliemae/*']),
|
|
200
187
|
},
|
|
201
188
|
],
|
|
202
189
|
},
|
|
203
190
|
plugins: plugins.concat(options.plugins || []),
|
|
204
191
|
resolve: {
|
|
205
192
|
modules: ['node_modules', 'app', 'lib'],
|
|
206
|
-
extensions: ['.
|
|
193
|
+
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json', '.wasm', '.mjs'],
|
|
207
194
|
mainFields: ['browser', 'module', 'main'],
|
|
208
195
|
alias: {
|
|
209
|
-
'lodash-es': 'lodash',
|
|
210
196
|
...getAlias(),
|
|
211
197
|
...((options.resolve || {}).alias || {}),
|
|
212
198
|
},
|
|
@@ -217,6 +203,5 @@ module.exports = (options) => ({
|
|
|
217
203
|
'@elliemae/pui-diagnostics': 'emuiDiagnostics',
|
|
218
204
|
},
|
|
219
205
|
devtool: options.devtool || 'eval-source-map',
|
|
220
|
-
target: 'web', // Make web variables accessible to webpack, e.g. window
|
|
221
206
|
performance: options.performance || {},
|
|
222
207
|
});
|
|
@@ -28,13 +28,14 @@ module.exports = require('./webpack.lib.base.babel')({
|
|
|
28
28
|
// Add development plugins
|
|
29
29
|
plugins: [
|
|
30
30
|
new HtmlWebpackPlugin({
|
|
31
|
+
scriptLoading: 'module',
|
|
31
32
|
inject: true, // Inject all files that are generated by webpack, e.g. bundle.js
|
|
32
33
|
template: 'lib/index.pug',
|
|
33
34
|
filename: 'index.html',
|
|
34
35
|
libraryName,
|
|
35
36
|
}),
|
|
36
37
|
new CircularDependencyPlugin({
|
|
37
|
-
exclude: /a\.js|node_modules/, // exclude node_modules
|
|
38
|
+
exclude: /a\.(js|ts|jsx|tsx)|node_modules/, // exclude node_modules
|
|
38
39
|
failOnError: false, // show a warning when there is a circular dependency
|
|
39
40
|
}),
|
|
40
41
|
new MiniCssExtractPlugin({
|
|
@@ -43,8 +44,6 @@ module.exports = require('./webpack.lib.base.babel')({
|
|
|
43
44
|
}),
|
|
44
45
|
],
|
|
45
46
|
|
|
46
|
-
// Emit a source map for easier debugging
|
|
47
|
-
// See https://webpack.js.org/configuration/devtool/#devtool
|
|
48
47
|
devtool: 'eval-source-map',
|
|
49
48
|
|
|
50
49
|
performance: {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
|
-
const CompressionPlugin = require('compression-webpack-plugin');
|
|
3
2
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
4
3
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
5
4
|
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
|
|
6
5
|
const { ESBuildMinifyPlugin } = require('esbuild-loader');
|
|
7
|
-
const
|
|
8
|
-
const {
|
|
6
|
+
const browserslistToEsbuild = require('browserslist-to-esbuild');
|
|
7
|
+
const { getLibraryName, getCompressionPlugins } = require('./helpers');
|
|
9
8
|
|
|
10
9
|
const libraryName = getLibraryName();
|
|
11
10
|
|
|
@@ -24,7 +23,7 @@ module.exports = require('./webpack.lib.base.babel')({
|
|
|
24
23
|
minimize: true,
|
|
25
24
|
minimizer: [
|
|
26
25
|
new ESBuildMinifyPlugin({
|
|
27
|
-
target:
|
|
26
|
+
target: browserslistToEsbuild(),
|
|
28
27
|
css: true,
|
|
29
28
|
}),
|
|
30
29
|
],
|
|
@@ -39,6 +38,7 @@ module.exports = require('./webpack.lib.base.babel')({
|
|
|
39
38
|
plugins: [
|
|
40
39
|
// Minify and optimize the index.html
|
|
41
40
|
new HtmlWebpackPlugin({
|
|
41
|
+
scriptLoading: 'module',
|
|
42
42
|
template: 'lib/index.pug',
|
|
43
43
|
filename: 'index.html',
|
|
44
44
|
libraryName,
|
|
@@ -62,13 +62,7 @@ module.exports = require('./webpack.lib.base.babel')({
|
|
|
62
62
|
chunkFilename: `css/${libraryName}.[contenthash].chunk.css`,
|
|
63
63
|
}),
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
filename: '[path][base].gz',
|
|
67
|
-
algorithm: 'gzip',
|
|
68
|
-
test: /\.js$|\.css$$/,
|
|
69
|
-
// we are compressing all files since in aws cloudfront edge lambda, we don't want to whitelist files that are not compressed due to below limits
|
|
70
|
-
minRatio: Number.MAX_SAFE_INTEGER,
|
|
71
|
-
}),
|
|
65
|
+
...getCompressionPlugins(true),
|
|
72
66
|
|
|
73
67
|
new BundleAnalyzerPlugin({
|
|
74
68
|
analyzerMode: 'static',
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
4
4
|
const { GenerateSW } = require('workbox-webpack-plugin');
|
|
5
|
-
const CompressionPlugin = require('compression-webpack-plugin');
|
|
6
5
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
7
6
|
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
|
|
8
7
|
const { ESBuildMinifyPlugin } = require('esbuild-loader');
|
|
8
|
+
const SpeedMeasurePlugin = require('speed-measure-webpack-plugin');
|
|
9
|
+
const browserslistToEsbuild = require('browserslist-to-esbuild');
|
|
9
10
|
|
|
10
11
|
const baseConfigFactory = require('./webpack.base.babel');
|
|
11
12
|
const {
|
|
@@ -15,8 +16,8 @@ const {
|
|
|
15
16
|
getPaths,
|
|
16
17
|
getAppVersion,
|
|
17
18
|
isGoogleTagManagerEnabled,
|
|
19
|
+
getCompressionPlugins,
|
|
18
20
|
} = require('./helpers');
|
|
19
|
-
const { ESBUILD_TARGET } = require('../esbuild');
|
|
20
21
|
|
|
21
22
|
const getProdConfig = ({ latestVersion = true } = {}) => {
|
|
22
23
|
const { buildPath, publicPath } = getPaths(latestVersion);
|
|
@@ -41,7 +42,7 @@ const getProdConfig = ({ latestVersion = true } = {}) => {
|
|
|
41
42
|
moduleIds: 'deterministic',
|
|
42
43
|
minimizer: [
|
|
43
44
|
new ESBuildMinifyPlugin({
|
|
44
|
-
target:
|
|
45
|
+
target: browserslistToEsbuild(),
|
|
45
46
|
css: true,
|
|
46
47
|
}),
|
|
47
48
|
],
|
|
@@ -63,25 +64,12 @@ const getProdConfig = ({ latestVersion = true } = {}) => {
|
|
|
63
64
|
},
|
|
64
65
|
|
|
65
66
|
plugins: [
|
|
66
|
-
new MiniCssExtractPlugin({
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}),
|
|
67
|
+
// new MiniCssExtractPlugin({
|
|
68
|
+
// filename: 'css/[name].[contenthash].css',
|
|
69
|
+
// chunkFilename: 'css/[name].[contenthash].chunk.css',
|
|
70
|
+
// }),
|
|
70
71
|
|
|
71
|
-
|
|
72
|
-
filename: '[path][base].gz',
|
|
73
|
-
algorithm: 'gzip',
|
|
74
|
-
test: /\.js$|\.css$$/,
|
|
75
|
-
exclude: [
|
|
76
|
-
/\/adrum-ext/,
|
|
77
|
-
/\/emuiUserMonitoring/,
|
|
78
|
-
/\/emuiDiagnostics/,
|
|
79
|
-
/\/emuiAppLoader/,
|
|
80
|
-
/\/encwLoader/,
|
|
81
|
-
],
|
|
82
|
-
// we are compressing all files since in aws cloudfront edge lambda, we don't want to whitelist files that are not compressed due to below limits
|
|
83
|
-
minRatio: Number.MAX_SAFE_INTEGER,
|
|
84
|
-
}),
|
|
72
|
+
...getCompressionPlugins(),
|
|
85
73
|
|
|
86
74
|
new BundleAnalyzerPlugin({
|
|
87
75
|
analyzerMode: 'static',
|
|
@@ -114,6 +102,7 @@ const {
|
|
|
114
102
|
encwLoaderScriptPath,
|
|
115
103
|
} = getPaths();
|
|
116
104
|
const htmlWebpackPlugin = new HtmlWebpackPlugin({
|
|
105
|
+
scriptLoading: 'module',
|
|
117
106
|
filename: '../index.html',
|
|
118
107
|
inject: !isAppLoaderEnabled(),
|
|
119
108
|
template: !isAppLoaderEnabled()
|
|
@@ -155,6 +144,22 @@ const appVersionConfig = baseConfigFactory(
|
|
|
155
144
|
getProdConfig({ latestVersion: false }),
|
|
156
145
|
);
|
|
157
146
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
147
|
+
const addSMPPlugin = (config) => {
|
|
148
|
+
const smpConfig = new SpeedMeasurePlugin({
|
|
149
|
+
disable: !process.env.MEASURE,
|
|
150
|
+
}).wrap(config);
|
|
151
|
+
// mini css extract plugin is not working fine with smp
|
|
152
|
+
smpConfig.plugins.push(
|
|
153
|
+
new MiniCssExtractPlugin({
|
|
154
|
+
filename: 'css/[name].[contenthash].css',
|
|
155
|
+
chunkFilename: 'css/[name].[contenthash].chunk.css',
|
|
156
|
+
}),
|
|
157
|
+
);
|
|
158
|
+
return smpConfig;
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const config = isVersionedApp
|
|
162
|
+
? [latestVersionConfig, appVersionConfig].map(addSMPPlugin)
|
|
163
|
+
: addSMPPlugin(latestVersionConfig);
|
|
164
|
+
|
|
165
|
+
module.exports = config;
|