@elliemae/pui-cli 6.0.0-beta.8 → 6.0.2
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/svg.js +5 -3
- 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 +47 -81
- package/lib/webpack/webpack.dev.babel.js +16 -10
- package/lib/webpack/webpack.lib.base.babel.js +33 -55
- 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 +19 -98
- 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,11 +16,9 @@ const {
|
|
|
15
16
|
modulesToTranspile,
|
|
16
17
|
getAlias,
|
|
17
18
|
getPaths,
|
|
18
|
-
|
|
19
|
+
filterByFilePresence,
|
|
19
20
|
} = require('./helpers');
|
|
20
|
-
const { ESBUILD_TARGET } = require('../esbuild');
|
|
21
21
|
|
|
22
|
-
// get the application configuration
|
|
23
22
|
const minicssLoader = {
|
|
24
23
|
loader: MiniCssExtractPlugin.loader,
|
|
25
24
|
options: {},
|
|
@@ -32,9 +31,6 @@ const postcssPlugins = [PostcssPresetEnv({ autoprefixer: { grid: true } })];
|
|
|
32
31
|
const { buildPath, publicPath } = getPaths();
|
|
33
32
|
|
|
34
33
|
const plugins = [
|
|
35
|
-
// Always expose NODE_ENV to webpack, in order to use `process.env.NODE_ENV`
|
|
36
|
-
// inside your code for any environment checks; Terser will automatically
|
|
37
|
-
// drop any unreachable code.
|
|
38
34
|
new webpack.EnvironmentPlugin({
|
|
39
35
|
NODE_ENV: 'development',
|
|
40
36
|
ASSET_PATH: '/',
|
|
@@ -44,13 +40,11 @@ const plugins = [
|
|
|
44
40
|
new webpack.DefinePlugin({
|
|
45
41
|
APP_CONFIG: getAppConfig(),
|
|
46
42
|
}),
|
|
47
|
-
new CaseSensitivePathsPlugin(),
|
|
48
|
-
// new ESLintPlugin(),
|
|
49
43
|
new ProvidePlugin({
|
|
50
44
|
React: 'react',
|
|
51
45
|
}),
|
|
52
46
|
new CopyWebpackPlugin({
|
|
53
|
-
patterns: [
|
|
47
|
+
patterns: filterByFilePresence([
|
|
54
48
|
{
|
|
55
49
|
from: 'app/app.config.json',
|
|
56
50
|
to: 'app.config.json',
|
|
@@ -94,17 +88,35 @@ const plugins = [
|
|
|
94
88
|
{
|
|
95
89
|
from: 'public',
|
|
96
90
|
noErrorOnMissing: true,
|
|
91
|
+
globOptions: {
|
|
92
|
+
ignore: ['readme.md'],
|
|
93
|
+
},
|
|
97
94
|
},
|
|
98
95
|
{
|
|
99
96
|
from: 'webroot',
|
|
100
97
|
to: '../',
|
|
101
98
|
noErrorOnMissing: true,
|
|
99
|
+
globOptions: {
|
|
100
|
+
ignore: ['readme.md'],
|
|
101
|
+
},
|
|
102
102
|
},
|
|
103
|
-
],
|
|
103
|
+
]),
|
|
104
104
|
}),
|
|
105
105
|
new DuplicatePackageCheckerPlugin(),
|
|
106
|
-
new MomentLocalesPlugin(),
|
|
106
|
+
new MomentLocalesPlugin({ localesToKeep: ['es-us'] }),
|
|
107
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(),
|
|
108
120
|
];
|
|
109
121
|
|
|
110
122
|
module.exports = (options) => ({
|
|
@@ -112,7 +124,6 @@ module.exports = (options) => ({
|
|
|
112
124
|
entry: options.entry,
|
|
113
125
|
output: {
|
|
114
126
|
clean: true,
|
|
115
|
-
// Compile into js/build.js
|
|
116
127
|
path: buildPath,
|
|
117
128
|
publicPath,
|
|
118
129
|
...options.output,
|
|
@@ -121,39 +132,7 @@ module.exports = (options) => ({
|
|
|
121
132
|
module: {
|
|
122
133
|
rules: [
|
|
123
134
|
{
|
|
124
|
-
test: /\.
|
|
125
|
-
use: [
|
|
126
|
-
'file-loader',
|
|
127
|
-
{
|
|
128
|
-
loader: 'image-webpack-loader',
|
|
129
|
-
options: {
|
|
130
|
-
gifsicle: {
|
|
131
|
-
enabled: false,
|
|
132
|
-
},
|
|
133
|
-
},
|
|
134
|
-
},
|
|
135
|
-
],
|
|
136
|
-
enforce: 'pre',
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
test: /\.(js|ts|jsx|tsx)$/,
|
|
140
|
-
enforce: 'pre',
|
|
141
|
-
exclude: /node_modules/,
|
|
142
|
-
resolve: {
|
|
143
|
-
fullySpecified: false,
|
|
144
|
-
},
|
|
145
|
-
use: [
|
|
146
|
-
{
|
|
147
|
-
loader: 'webpack-strip-block',
|
|
148
|
-
options: {
|
|
149
|
-
start: 'TEST:START',
|
|
150
|
-
end: 'TEST:END',
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
|
-
],
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
test: /\.(js|jsx)$/,
|
|
135
|
+
test: /\.jsx?$/,
|
|
157
136
|
exclude: excludeNodeModulesExcept(modulesToTranspile),
|
|
158
137
|
resolve: {
|
|
159
138
|
fullySpecified: false,
|
|
@@ -162,12 +141,12 @@ module.exports = (options) => ({
|
|
|
162
141
|
loader: 'esbuild-loader',
|
|
163
142
|
options: {
|
|
164
143
|
loader: 'jsx',
|
|
165
|
-
target:
|
|
144
|
+
target: browserslistToEsbuild(),
|
|
166
145
|
},
|
|
167
146
|
},
|
|
168
147
|
},
|
|
169
148
|
{
|
|
170
|
-
test: /\.
|
|
149
|
+
test: /\.tsx?$/,
|
|
171
150
|
exclude: excludeNodeModulesExcept(modulesToTranspile),
|
|
172
151
|
resolve: {
|
|
173
152
|
fullySpecified: false,
|
|
@@ -176,12 +155,15 @@ module.exports = (options) => ({
|
|
|
176
155
|
loader: 'esbuild-loader',
|
|
177
156
|
options: {
|
|
178
157
|
loader: 'tsx',
|
|
179
|
-
target:
|
|
158
|
+
target: browserslistToEsbuild(),
|
|
180
159
|
},
|
|
181
160
|
},
|
|
182
161
|
},
|
|
183
162
|
{
|
|
184
163
|
test: /\.css$/,
|
|
164
|
+
exclude: excludeNodeModulesExcept(
|
|
165
|
+
modulesToTranspile.concat(['sanitize.css']),
|
|
166
|
+
),
|
|
185
167
|
use: [
|
|
186
168
|
finalCSSLoader(options.mode),
|
|
187
169
|
{
|
|
@@ -191,13 +173,6 @@ module.exports = (options) => ({
|
|
|
191
173
|
sourceMap: true,
|
|
192
174
|
},
|
|
193
175
|
},
|
|
194
|
-
{
|
|
195
|
-
loader: 'esbuild-loader',
|
|
196
|
-
options: {
|
|
197
|
-
loader: 'css',
|
|
198
|
-
minify: options.mode === 'production',
|
|
199
|
-
},
|
|
200
|
-
},
|
|
201
176
|
{
|
|
202
177
|
loader: 'postcss-loader',
|
|
203
178
|
options: {
|
|
@@ -211,47 +186,39 @@ module.exports = (options) => ({
|
|
|
211
186
|
},
|
|
212
187
|
{
|
|
213
188
|
test: /\.(woff|woff2)$/,
|
|
214
|
-
exclude: excludeNodeModulesExcept(['@elliemae/*']),
|
|
215
189
|
type: 'asset/resource',
|
|
190
|
+
exclude: excludeNodeModulesExcept(modulesToTranspile),
|
|
216
191
|
},
|
|
217
192
|
{
|
|
218
|
-
test: /\.svg
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
loader: 'file-loader',
|
|
226
|
-
options: {
|
|
227
|
-
name: getMediaPath(),
|
|
228
|
-
},
|
|
229
|
-
},
|
|
230
|
-
],
|
|
231
|
-
},
|
|
232
|
-
{
|
|
233
|
-
test: /\.(jpe?g|png|gif|ico)$/i,
|
|
234
|
-
exclude: excludeNodeModulesExcept(['@elliemae/*']),
|
|
235
|
-
type: 'asset',
|
|
193
|
+
test: /\.svg$/i,
|
|
194
|
+
issuer: /\.[jt]sx?$/,
|
|
195
|
+
resourceQuery: /^((?!url).)*$/,
|
|
196
|
+
exclude: excludeNodeModulesExcept(modulesToTranspile),
|
|
197
|
+
use: ['@svgr/webpack'],
|
|
236
198
|
},
|
|
237
199
|
{
|
|
238
|
-
test: /\.(mp4|webm)
|
|
239
|
-
exclude: excludeNodeModulesExcept(
|
|
200
|
+
test: /\.(jpe?g|png|gif|ico|mp4|webm)$/i,
|
|
201
|
+
exclude: excludeNodeModulesExcept(modulesToTranspile),
|
|
240
202
|
type: 'asset',
|
|
241
203
|
},
|
|
242
204
|
{
|
|
243
205
|
resourceQuery: /resource/,
|
|
244
206
|
type: 'asset/resource',
|
|
207
|
+
exclude: excludeNodeModulesExcept(modulesToTranspile),
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
type: 'asset',
|
|
211
|
+
resourceQuery: /url/,
|
|
212
|
+
exclude: excludeNodeModulesExcept(modulesToTranspile),
|
|
245
213
|
},
|
|
246
214
|
],
|
|
247
215
|
},
|
|
248
216
|
plugins: plugins.concat(options.plugins),
|
|
249
217
|
resolve: {
|
|
250
218
|
modules: ['node_modules', 'app', 'lib'],
|
|
251
|
-
extensions: ['.
|
|
219
|
+
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json', '.wasm', '.mjs'],
|
|
252
220
|
mainFields: ['browser', 'module', 'main'],
|
|
253
221
|
alias: {
|
|
254
|
-
'lodash-es': 'lodash',
|
|
255
222
|
...getAlias(),
|
|
256
223
|
...((options.resolve || {}).alias || {}),
|
|
257
224
|
},
|
|
@@ -262,6 +229,5 @@ module.exports = (options) => ({
|
|
|
262
229
|
'@elliemae/pui-diagnostics': 'emuiDiagnostics',
|
|
263
230
|
},
|
|
264
231
|
devtool: options.devtool || 'eval-source-map',
|
|
265
|
-
target: 'web', // Make web variables accessible to webpack, e.g. window
|
|
266
232
|
performance: options.performance || {},
|
|
267
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,9 +19,8 @@ const {
|
|
|
18
19
|
modulesToTranspile,
|
|
19
20
|
getAssetPath,
|
|
20
21
|
getAlias,
|
|
21
|
-
|
|
22
|
+
filterByFilePresence,
|
|
22
23
|
} = require('./helpers');
|
|
23
|
-
const { ESBUILD_TARGET } = require('../esbuild');
|
|
24
24
|
|
|
25
25
|
const minicssLoader = {
|
|
26
26
|
loader: MiniCssExtractPlugin.loader,
|
|
@@ -31,33 +31,33 @@ const finalCSSLoader = (mode) =>
|
|
|
31
31
|
mode !== 'production' ? { loader: 'style-loader' } : minicssLoader;
|
|
32
32
|
|
|
33
33
|
const plugins = [
|
|
34
|
-
new
|
|
34
|
+
new EnvironmentPlugin({
|
|
35
35
|
NODE_ENV: 'development',
|
|
36
36
|
ASSET_PATH: '/',
|
|
37
37
|
CI: 'false',
|
|
38
38
|
}),
|
|
39
|
-
new
|
|
39
|
+
new DefinePlugin({
|
|
40
40
|
APP_CONFIG: getAppConfig(true),
|
|
41
41
|
}),
|
|
42
|
-
new CaseSensitivePathsPlugin(),
|
|
43
42
|
new CopyWebpackPlugin({
|
|
44
|
-
patterns: [
|
|
43
|
+
patterns: filterByFilePresence([
|
|
45
44
|
{
|
|
46
45
|
from: 'lib/app.config.json',
|
|
47
46
|
to: 'app.config.json',
|
|
48
47
|
noErrorOnMissing: true,
|
|
49
48
|
},
|
|
50
49
|
{
|
|
51
|
-
from: '
|
|
50
|
+
from: 'lib/public',
|
|
52
51
|
noErrorOnMissing: true,
|
|
53
52
|
},
|
|
54
|
-
],
|
|
53
|
+
]),
|
|
55
54
|
}),
|
|
56
55
|
new DuplicatePackageCheckerPlugin(),
|
|
57
56
|
new LimitChunkCountPlugin({
|
|
58
57
|
maxChunks: 1,
|
|
59
58
|
}),
|
|
60
|
-
new MomentLocalesPlugin(),
|
|
59
|
+
new MomentLocalesPlugin({ localesToKeep: ['es-us'] }),
|
|
60
|
+
new ProgressPlugin(),
|
|
61
61
|
];
|
|
62
62
|
|
|
63
63
|
module.exports = (options) => ({
|
|
@@ -75,39 +75,21 @@ module.exports = (options) => ({
|
|
|
75
75
|
module: {
|
|
76
76
|
rules: [
|
|
77
77
|
{
|
|
78
|
-
test:
|
|
79
|
-
|
|
80
|
-
'file-loader',
|
|
81
|
-
{
|
|
82
|
-
loader: 'image-webpack-loader',
|
|
83
|
-
options: {
|
|
84
|
-
gifsicle: {
|
|
85
|
-
enabled: false,
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
],
|
|
90
|
-
enforce: 'pre',
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
test: /^(?!.*\.exec\.js$).*\.(js|ts|jsx|tsx)$/,
|
|
94
|
-
enforce: 'pre',
|
|
95
|
-
exclude: /node_modules/,
|
|
78
|
+
test: /^(?!.*\.exec\.js$).*\.jsx?$/, // Transform all .js and .jsx files with Babel
|
|
79
|
+
exclude: excludeNodeModulesExcept(modulesToTranspile),
|
|
96
80
|
resolve: {
|
|
97
81
|
fullySpecified: false,
|
|
98
82
|
},
|
|
99
|
-
use:
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
end: 'TEST:END',
|
|
105
|
-
},
|
|
83
|
+
use: {
|
|
84
|
+
loader: 'esbuild-loader',
|
|
85
|
+
options: {
|
|
86
|
+
loader: 'jsx',
|
|
87
|
+
target: browserslistToEsbuild(),
|
|
106
88
|
},
|
|
107
|
-
|
|
89
|
+
},
|
|
108
90
|
},
|
|
109
91
|
{
|
|
110
|
-
test: /^(?!.*\.exec\.js$).*\.
|
|
92
|
+
test: /^(?!.*\.exec\.js$).*\.tsx?$/, // Transform all .js and .jsx files with Babel
|
|
111
93
|
exclude: excludeNodeModulesExcept(modulesToTranspile),
|
|
112
94
|
resolve: {
|
|
113
95
|
fullySpecified: false,
|
|
@@ -115,8 +97,8 @@ module.exports = (options) => ({
|
|
|
115
97
|
use: {
|
|
116
98
|
loader: 'esbuild-loader',
|
|
117
99
|
options: {
|
|
118
|
-
loader: '
|
|
119
|
-
target:
|
|
100
|
+
loader: 'tsx',
|
|
101
|
+
target: browserslistToEsbuild(),
|
|
120
102
|
},
|
|
121
103
|
},
|
|
122
104
|
},
|
|
@@ -172,19 +154,11 @@ module.exports = (options) => ({
|
|
|
172
154
|
type: 'asset/resource',
|
|
173
155
|
},
|
|
174
156
|
{
|
|
175
|
-
test: /\.svg
|
|
157
|
+
test: /\.svg$/i,
|
|
158
|
+
issuer: /\.[jt]sx?$/,
|
|
159
|
+
resourceQuery: /^((?!url).)*$/,
|
|
176
160
|
exclude: excludeNodeModulesExcept(['@elliemae/*']),
|
|
177
|
-
use: [
|
|
178
|
-
{
|
|
179
|
-
loader: '@svgr/webpack',
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
loader: 'file-loader',
|
|
183
|
-
options: {
|
|
184
|
-
name: getMediaPath(),
|
|
185
|
-
},
|
|
186
|
-
},
|
|
187
|
-
],
|
|
161
|
+
use: ['@svgr/webpack'],
|
|
188
162
|
},
|
|
189
163
|
{
|
|
190
164
|
test: /\.(jpe?g|png|gif|ico)$/i,
|
|
@@ -204,16 +178,21 @@ module.exports = (options) => ({
|
|
|
204
178
|
{
|
|
205
179
|
resourceQuery: /resource/,
|
|
206
180
|
type: 'asset/resource',
|
|
181
|
+
exclude: excludeNodeModulesExcept(['@elliemae/*']),
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
type: 'asset',
|
|
185
|
+
resourceQuery: /url/,
|
|
186
|
+
exclude: excludeNodeModulesExcept(['@elliemae/*']),
|
|
207
187
|
},
|
|
208
188
|
],
|
|
209
189
|
},
|
|
210
190
|
plugins: plugins.concat(options.plugins || []),
|
|
211
191
|
resolve: {
|
|
212
192
|
modules: ['node_modules', 'app', 'lib'],
|
|
213
|
-
extensions: ['.
|
|
193
|
+
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json', '.wasm', '.mjs'],
|
|
214
194
|
mainFields: ['browser', 'module', 'main'],
|
|
215
195
|
alias: {
|
|
216
|
-
'lodash-es': 'lodash',
|
|
217
196
|
...getAlias(),
|
|
218
197
|
...((options.resolve || {}).alias || {}),
|
|
219
198
|
},
|
|
@@ -224,6 +203,5 @@ module.exports = (options) => ({
|
|
|
224
203
|
'@elliemae/pui-diagnostics': 'emuiDiagnostics',
|
|
225
204
|
},
|
|
226
205
|
devtool: options.devtool || 'eval-source-map',
|
|
227
|
-
target: 'web', // Make web variables accessible to webpack, e.g. window
|
|
228
206
|
performance: options.performance || {},
|
|
229
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;
|