@elliemae/pui-cli 6.0.0-beta.4 → 6.0.0-beta.40
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/lib/cli-commands/pack.js +1 -1
- 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/lint/eslint/common.js +12 -7
- 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/pui-config/index.js +18 -0
- package/lib/server/index.js +5 -9
- package/lib/server/middlewares/addDevMiddlewares.js +2 -2
- package/lib/server/middlewares/addProdMiddlewares.js +10 -3
- package/lib/testing/jest.config.js +26 -7
- 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/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 +9 -0
- package/lib/transpile/.swcrc +11 -0
- package/lib/transpile/esbuild.js +62 -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 +37 -3
- package/lib/webpack/webpack.base.babel.js +43 -69
- package/lib/webpack/webpack.dev.babel.js +2 -2
- package/lib/webpack/webpack.lib.base.babel.js +27 -48
- package/lib/webpack/webpack.lib.dev.babel.js +1 -2
- package/lib/webpack/webpack.lib.prod.babel.js +6 -11
- package/lib/webpack/webpack.prod.babel.js +6 -11
- package/lib/webpack/webpack.storybook.js +20 -88
- package/package.json +109 -100
- package/lib/esbuild.js +0 -39
- package/lib/testing/setup-styled-components-tests.js +0 -1
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const resolutions = [
|
|
2
|
+
{
|
|
3
|
+
matcher: /\.jsx?$/i,
|
|
4
|
+
extensions: ['.tsx', '.ts'],
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
matcher: /\.mjs$/i,
|
|
8
|
+
extensions: ['.mts'],
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
matcher: /\.cjs$/i,
|
|
12
|
+
extensions: ['.cts'],
|
|
13
|
+
},
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
const resolveConfig = {
|
|
17
|
+
conditionNames: ['import', 'node', 'default'],
|
|
18
|
+
extensions: ['.ts', '.tsx', '.js', '.jsx', '.json', '.node'],
|
|
19
|
+
modules: ['node_modules', 'app', 'lib'],
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const importResolver = require('enhanced-resolve').create.sync(resolveConfig);
|
|
23
|
+
const requireResolver = require('enhanced-resolve').create.sync({
|
|
24
|
+
...resolveConfig,
|
|
25
|
+
conditionNames: ['require', 'node', 'default'],
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
module.exports = (request, options) => {
|
|
29
|
+
let resolver = requireResolver;
|
|
30
|
+
if (options.conditions?.includes('import')) {
|
|
31
|
+
resolver = importResolver;
|
|
32
|
+
}
|
|
33
|
+
const resolution = resolutions.find(({ matcher }) => matcher.test(request));
|
|
34
|
+
if (resolution) {
|
|
35
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
36
|
+
for (const extension of resolution.extensions) {
|
|
37
|
+
try {
|
|
38
|
+
return resolver(
|
|
39
|
+
options.basedir,
|
|
40
|
+
request.replace(resolution.matcher, extension),
|
|
41
|
+
);
|
|
42
|
+
// eslint-disable-next-line no-empty
|
|
43
|
+
} catch {}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return resolver(options.basedir, request);
|
|
47
|
+
};
|
|
@@ -3,12 +3,36 @@
|
|
|
3
3
|
import 'core-js/stable';
|
|
4
4
|
import 'regenerator-runtime/runtime';
|
|
5
5
|
import '@testing-library/jest-dom/extend-expect';
|
|
6
|
-
import
|
|
6
|
+
import jestAxe from 'jest-axe';
|
|
7
7
|
import ResizeObserver from 'resize-observer-polyfill';
|
|
8
|
-
import addMatchMedia from './mocks/matchMedia';
|
|
9
|
-
import { logger } from './mocks/pui-diagnostics';
|
|
8
|
+
import addMatchMedia from './mocks/matchMedia.js';
|
|
9
|
+
import { logger } from './mocks/pui-diagnostics.js';
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
// eslint-disable-next-line no-console
|
|
12
|
+
const originalError = console.error;
|
|
13
|
+
// eslint-disable-next-line no-console
|
|
14
|
+
console.error = (...args) => {
|
|
15
|
+
const ignoreList = [
|
|
16
|
+
`Warning: Can't perform a React state update on an unmounted component`,
|
|
17
|
+
`Warning: Function components cannot be given refs`,
|
|
18
|
+
`Warning: Failed %s type:`,
|
|
19
|
+
`Warning: Invalid DOM property`,
|
|
20
|
+
`Warning: Each child in a list should have a unique`,
|
|
21
|
+
'Warning: Received `%s` for a non-boolean attribute',
|
|
22
|
+
'Warning: <%s /> is using incorrect casing.',
|
|
23
|
+
'Warning: The tag <%s> is unrecognized in this browser',
|
|
24
|
+
'Warning: Invalid arguments supplied to oneOf',
|
|
25
|
+
];
|
|
26
|
+
if (
|
|
27
|
+
ignoreList.find(
|
|
28
|
+
(ignoreMsg) => !!args.find((arg) => arg.includes?.(ignoreMsg)),
|
|
29
|
+
)
|
|
30
|
+
)
|
|
31
|
+
return false;
|
|
32
|
+
return originalError(...args);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
if (expect) expect.extend(jestAxe.toHaveNoViolations);
|
|
12
36
|
jest.setTimeout(60000);
|
|
13
37
|
|
|
14
38
|
const addElementToBody = (element) => {
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
const esbuild = require('esbuild');
|
|
2
|
+
const fg = require('fast-glob');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const { getPUIConfig } = require('../pui-config');
|
|
6
|
+
|
|
7
|
+
const { esBuild } = getPUIConfig();
|
|
8
|
+
|
|
9
|
+
const commonConfig = {
|
|
10
|
+
bundle: false,
|
|
11
|
+
target: esBuild.target,
|
|
12
|
+
loader: { '.js': 'jsx' },
|
|
13
|
+
mainFields: ['module', 'browser', 'main'],
|
|
14
|
+
inject: [path.resolve(__dirname, './react-shim.js')],
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const distFolder = 'dist';
|
|
18
|
+
|
|
19
|
+
const copyFiles = async ({ srcdir, outdir }) => {
|
|
20
|
+
const files = await fg([
|
|
21
|
+
`${srcdir}/**/*.*`,
|
|
22
|
+
`!${srcdir}/**/*.{js,jsx,ts,tsx,cjs,mjs}`,
|
|
23
|
+
]);
|
|
24
|
+
files.forEach((srcFilePath) => {
|
|
25
|
+
const destFilePath = srcFilePath.replace(srcdir, outdir);
|
|
26
|
+
fs.copyFileSync(srcFilePath, destFilePath);
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const build = async ({ srcPath, commonJS }) => {
|
|
31
|
+
const inputFiles = [
|
|
32
|
+
`${srcPath}/**/*.{js,jsx,ts,tsx}`,
|
|
33
|
+
`!${srcPath}/**/*.test.{js,jsx,ts,tsx}`,
|
|
34
|
+
`!${srcPath}/**/*.stories.{js,jsx,ts,tsx}`,
|
|
35
|
+
`!${srcPath}/**/*.endpoint.{js,jsx,ts,tsx}`,
|
|
36
|
+
];
|
|
37
|
+
if (commonJS) {
|
|
38
|
+
const outdir = `${distFolder}/cjs`;
|
|
39
|
+
const commonJSEntryPoints = await fg(inputFiles);
|
|
40
|
+
await esbuild.build({
|
|
41
|
+
entryPoints: commonJSEntryPoints,
|
|
42
|
+
...commonConfig,
|
|
43
|
+
outdir,
|
|
44
|
+
format: 'cjs',
|
|
45
|
+
});
|
|
46
|
+
await copyFiles({ srcdir: srcPath, outdir });
|
|
47
|
+
} else {
|
|
48
|
+
const outdir = `${distFolder}/es`;
|
|
49
|
+
const entryPoints = await fg(
|
|
50
|
+
inputFiles.concat([`!${srcPath}/**/cjs/**/*.{js,jsx,ts,tsx}`]),
|
|
51
|
+
);
|
|
52
|
+
await esbuild.build({
|
|
53
|
+
entryPoints,
|
|
54
|
+
...commonConfig,
|
|
55
|
+
outdir,
|
|
56
|
+
format: 'esm',
|
|
57
|
+
});
|
|
58
|
+
await copyFiles({ srcdir: srcPath, outdir });
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
exports.esBuild = build;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const { merge } = require('lodash');
|
|
4
|
+
|
|
5
|
+
let projectConfig = {};
|
|
6
|
+
const projectPath = path.join(process.cwd(), '.swcrc');
|
|
7
|
+
if (fs.existsSync(projectPath)) {
|
|
8
|
+
projectConfig = JSON.parse(fs.readFileSync(projectPath, 'utf-8'));
|
|
9
|
+
}
|
|
10
|
+
const localConfig = JSON.parse(
|
|
11
|
+
fs.readFileSync(path.join(__dirname, '.swcrc'), 'utf-8'),
|
|
12
|
+
);
|
|
13
|
+
module.exports = merge(localConfig, projectConfig);
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
const execa = require('execa');
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
|
|
5
|
+
const { randomChars, resolveFromRoot } = require('./utils');
|
|
6
|
+
|
|
7
|
+
const args = process.argv.slice(2);
|
|
8
|
+
const argsProjectIndex = args.findIndex((arg) =>
|
|
9
|
+
['-p', '--project'].includes(arg),
|
|
10
|
+
);
|
|
11
|
+
const argsProjectValue =
|
|
12
|
+
argsProjectIndex !== -1 ? args[argsProjectIndex + 1] : undefined;
|
|
13
|
+
|
|
14
|
+
const files = args.filter((file) => /\.(ts|tsx)$/.test(file));
|
|
15
|
+
if (files.length === 0) {
|
|
16
|
+
process.exit(0);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const remainingArgsToForward = args
|
|
20
|
+
.slice()
|
|
21
|
+
.filter((arg) => !files.includes(arg));
|
|
22
|
+
|
|
23
|
+
if (argsProjectIndex !== -1) {
|
|
24
|
+
remainingArgsToForward.splice(argsProjectIndex, 2);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Load existing config
|
|
28
|
+
const tsconfigPath = argsProjectValue || resolveFromRoot('tsconfig.json');
|
|
29
|
+
const tsconfigContent = fs.readFileSync(tsconfigPath).toString();
|
|
30
|
+
// Use 'eval' to read the JSON as regular JavaScript syntax so that comments are allowed
|
|
31
|
+
// eslint-disable-next-line prefer-const
|
|
32
|
+
let tsconfig = {};
|
|
33
|
+
// eslint-disable-next-line no-eval
|
|
34
|
+
eval(`tsconfig = ${tsconfigContent}`);
|
|
35
|
+
|
|
36
|
+
// Write a temp config file
|
|
37
|
+
const tmpTsconfigPath = resolveFromRoot(`tsconfig.${randomChars()}.json`);
|
|
38
|
+
const tmpTsconfig = {
|
|
39
|
+
...tsconfig,
|
|
40
|
+
compilerOptions: {
|
|
41
|
+
...tsconfig.compilerOptions,
|
|
42
|
+
skipLibCheck: true,
|
|
43
|
+
},
|
|
44
|
+
files,
|
|
45
|
+
include: ['app', 'lib'],
|
|
46
|
+
};
|
|
47
|
+
fs.writeFileSync(tmpTsconfigPath, JSON.stringify(tmpTsconfig, null, 2));
|
|
48
|
+
|
|
49
|
+
// Type-check our files
|
|
50
|
+
let status = 0;
|
|
51
|
+
try {
|
|
52
|
+
execa.sync(
|
|
53
|
+
path.resolve(
|
|
54
|
+
process.cwd(),
|
|
55
|
+
`./node_modules/.bin/tsc${process.platform === 'win32' ? '.cmd' : ''}`,
|
|
56
|
+
),
|
|
57
|
+
['-p', tmpTsconfigPath, ...remainingArgsToForward],
|
|
58
|
+
{ stdio: 'inherit' },
|
|
59
|
+
);
|
|
60
|
+
} catch (ex) {
|
|
61
|
+
status = ex.exitCode;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Delete temp config file
|
|
65
|
+
fs.unlinkSync(tmpTsconfigPath);
|
|
66
|
+
process.exit(status);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const { dirname, join } = require('path');
|
|
2
|
+
|
|
3
|
+
const randomChars = () => Math.random().toString(36).slice(2);
|
|
4
|
+
|
|
5
|
+
const resolveFromModule = (moduleName, ...paths) => {
|
|
6
|
+
const modulePath = dirname(require.resolve(`${moduleName}/package.json`));
|
|
7
|
+
return join(modulePath, ...paths);
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const resolveFromRoot = (...paths) => join(process.cwd(), ...paths);
|
|
11
|
+
|
|
12
|
+
module.exports = {
|
|
13
|
+
randomChars,
|
|
14
|
+
resolveFromModule,
|
|
15
|
+
resolveFromRoot,
|
|
16
|
+
};
|
package/lib/webpack/helpers.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
/* eslint-disable max-lines */
|
|
1
2
|
const path = require('path');
|
|
2
3
|
const fs = require('fs');
|
|
3
4
|
const _ = require('lodash');
|
|
5
|
+
const CompressionPlugin = require('compression-webpack-plugin');
|
|
6
|
+
const zlib = require('zlib');
|
|
4
7
|
|
|
5
8
|
let pathSep = path.sep;
|
|
6
9
|
if (pathSep === '\\')
|
|
@@ -69,13 +72,11 @@ const getAlias = () =>
|
|
|
69
72
|
'@babel/runtime',
|
|
70
73
|
'react',
|
|
71
74
|
'react-dom',
|
|
72
|
-
'react-router-dom',
|
|
73
75
|
'react-redux',
|
|
74
76
|
'redux',
|
|
75
77
|
'redux-saga',
|
|
76
78
|
'moment',
|
|
77
79
|
'lodash',
|
|
78
|
-
'connected-react-router',
|
|
79
80
|
'styled-components',
|
|
80
81
|
'immer',
|
|
81
82
|
'react-dates',
|
|
@@ -122,7 +123,6 @@ const getAppLoaderFileName = () => {
|
|
|
122
123
|
|
|
123
124
|
const getDiagnosticsFileName = () => {
|
|
124
125
|
const libName = 'emuiDiagnostics';
|
|
125
|
-
// eslint-disable-next-line max-lines
|
|
126
126
|
const libPath = path.join(
|
|
127
127
|
process.cwd(),
|
|
128
128
|
'node_modules/@elliemae/pui-diagnostics/dist/public/js',
|
|
@@ -185,6 +185,39 @@ const isGoogleTagManagerEnabled = () => {
|
|
|
185
185
|
return !!appConfig?.googleTagManager;
|
|
186
186
|
};
|
|
187
187
|
|
|
188
|
+
const getCompressionPlugins = (isLibrary = false) => {
|
|
189
|
+
const excludeList = [
|
|
190
|
+
/\/adrum-ext/,
|
|
191
|
+
/\/emuiUserMonitoring/,
|
|
192
|
+
/\/emuiDiagnostics/,
|
|
193
|
+
/\/emuiAppLoader/,
|
|
194
|
+
/\/encwLoader/,
|
|
195
|
+
];
|
|
196
|
+
const commonConfig = {
|
|
197
|
+
test: /\.(js|css)$/,
|
|
198
|
+
exclude: !isLibrary ? excludeList : [],
|
|
199
|
+
// 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
|
|
200
|
+
minRatio: Number.MAX_SAFE_INTEGER,
|
|
201
|
+
};
|
|
202
|
+
return [
|
|
203
|
+
new CompressionPlugin({
|
|
204
|
+
filename: '[path][base].gz',
|
|
205
|
+
algorithm: 'gzip',
|
|
206
|
+
...commonConfig,
|
|
207
|
+
}),
|
|
208
|
+
new CompressionPlugin({
|
|
209
|
+
filename: '[path][base].br',
|
|
210
|
+
algorithm: 'brotliCompress',
|
|
211
|
+
...commonConfig,
|
|
212
|
+
compressionOptions: {
|
|
213
|
+
params: {
|
|
214
|
+
[zlib.constants.BROTLI_PARAM_QUALITY]: 11,
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
}),
|
|
218
|
+
];
|
|
219
|
+
};
|
|
220
|
+
|
|
188
221
|
exports.excludeNodeModulesExcept = excludeNodeModulesExcept;
|
|
189
222
|
exports.getLibraryName = getLibraryName;
|
|
190
223
|
exports.getAppConfig = getAppConfig;
|
|
@@ -209,3 +242,4 @@ exports.resolveExtensions = [
|
|
|
209
242
|
];
|
|
210
243
|
exports.mainFields = ['browser', 'module', 'main'];
|
|
211
244
|
exports.isGoogleTagManagerEnabled = isGoogleTagManagerEnabled;
|
|
245
|
+
exports.getCompressionPlugins = getCompressionPlugins;
|
|
@@ -7,7 +7,7 @@ const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack
|
|
|
7
7
|
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
|
|
8
8
|
const MomentLocalesPlugin = require('moment-locales-webpack-plugin');
|
|
9
9
|
const { WebpackManifestPlugin } = require('webpack-manifest-plugin');
|
|
10
|
-
const
|
|
10
|
+
const FaviconsWebpackPlugin = require('favicons-webpack-plugin');
|
|
11
11
|
const { ProvidePlugin } = require('webpack');
|
|
12
12
|
|
|
13
13
|
const {
|
|
@@ -16,13 +16,10 @@ const {
|
|
|
16
16
|
modulesToTranspile,
|
|
17
17
|
getAlias,
|
|
18
18
|
getPaths,
|
|
19
|
-
getMediaPath,
|
|
20
19
|
} = require('./helpers');
|
|
21
|
-
const {
|
|
22
|
-
const {
|
|
20
|
+
const { getPUIConfig } = require('../pui-config');
|
|
21
|
+
const { esBuild } = getPUIConfig();
|
|
23
22
|
|
|
24
|
-
// get the application configuration
|
|
25
|
-
const devMode = process.env.NODE_ENV !== 'production';
|
|
26
23
|
const minicssLoader = {
|
|
27
24
|
loader: MiniCssExtractPlugin.loader,
|
|
28
25
|
options: {},
|
|
@@ -35,9 +32,6 @@ const postcssPlugins = [PostcssPresetEnv({ autoprefixer: { grid: true } })];
|
|
|
35
32
|
const { buildPath, publicPath } = getPaths();
|
|
36
33
|
|
|
37
34
|
const plugins = [
|
|
38
|
-
// Always expose NODE_ENV to webpack, in order to use `process.env.NODE_ENV`
|
|
39
|
-
// inside your code for any environment checks; Terser will automatically
|
|
40
|
-
// drop any unreachable code.
|
|
41
35
|
new webpack.EnvironmentPlugin({
|
|
42
36
|
NODE_ENV: 'development',
|
|
43
37
|
ASSET_PATH: '/',
|
|
@@ -48,7 +42,6 @@ const plugins = [
|
|
|
48
42
|
APP_CONFIG: getAppConfig(),
|
|
49
43
|
}),
|
|
50
44
|
new CaseSensitivePathsPlugin(),
|
|
51
|
-
// new ESLintPlugin(),
|
|
52
45
|
new ProvidePlugin({
|
|
53
46
|
React: 'react',
|
|
54
47
|
}),
|
|
@@ -70,21 +63,29 @@ const plugins = [
|
|
|
70
63
|
{
|
|
71
64
|
from: 'node_modules/@elliemae/pui-user-monitoring/dist/public/js',
|
|
72
65
|
to: 'js',
|
|
66
|
+
toType: 'dir',
|
|
67
|
+
info: { minimized: true },
|
|
73
68
|
},
|
|
74
69
|
{
|
|
75
|
-
from: 'node_modules/@elliemae/pui-app-loader/dist/public/js
|
|
76
|
-
to: 'js
|
|
70
|
+
from: 'node_modules/@elliemae/pui-app-loader/dist/public/js',
|
|
71
|
+
to: 'js',
|
|
72
|
+
toType: 'dir',
|
|
77
73
|
noErrorOnMissing: true,
|
|
74
|
+
info: { minimized: true },
|
|
78
75
|
},
|
|
79
76
|
{
|
|
80
|
-
from: 'node_modules/@elliemae/encw-loader/dist/public/js
|
|
81
|
-
to: 'js
|
|
77
|
+
from: 'node_modules/@elliemae/encw-loader/dist/public/js',
|
|
78
|
+
to: 'js',
|
|
79
|
+
toType: 'dir',
|
|
82
80
|
noErrorOnMissing: true,
|
|
81
|
+
info: { minimized: true },
|
|
83
82
|
},
|
|
84
83
|
{
|
|
85
|
-
from: 'node_modules/@elliemae/pui-diagnostics/dist/public/js
|
|
86
|
-
to: 'js
|
|
84
|
+
from: 'node_modules/@elliemae/pui-diagnostics/dist/public/js',
|
|
85
|
+
to: 'js',
|
|
86
|
+
toType: 'dir',
|
|
87
87
|
noErrorOnMissing: true,
|
|
88
|
+
info: { minimized: true },
|
|
88
89
|
},
|
|
89
90
|
{
|
|
90
91
|
from: 'public',
|
|
@@ -100,25 +101,24 @@ const plugins = [
|
|
|
100
101
|
new DuplicatePackageCheckerPlugin(),
|
|
101
102
|
new MomentLocalesPlugin(),
|
|
102
103
|
new WebpackManifestPlugin(),
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
104
|
+
new FaviconsWebpackPlugin({
|
|
105
|
+
logo: './app/view/images/favicon.png',
|
|
106
|
+
favicons: {
|
|
107
|
+
developerName: 'ICE MT',
|
|
108
|
+
developerURL: null, // prevent retrieving from the nearest package.json
|
|
109
|
+
icons: {
|
|
110
|
+
coast: false,
|
|
111
|
+
yandex: false,
|
|
111
112
|
},
|
|
112
|
-
}
|
|
113
|
-
)
|
|
114
|
-
|
|
113
|
+
},
|
|
114
|
+
}),
|
|
115
|
+
];
|
|
115
116
|
|
|
116
117
|
module.exports = (options) => ({
|
|
117
118
|
mode: options.mode,
|
|
118
119
|
entry: options.entry,
|
|
119
120
|
output: {
|
|
120
121
|
clean: true,
|
|
121
|
-
// Compile into js/build.js
|
|
122
122
|
path: buildPath,
|
|
123
123
|
publicPath,
|
|
124
124
|
...options.output,
|
|
@@ -127,22 +127,7 @@ module.exports = (options) => ({
|
|
|
127
127
|
module: {
|
|
128
128
|
rules: [
|
|
129
129
|
{
|
|
130
|
-
test: /\.
|
|
131
|
-
use: [
|
|
132
|
-
'file-loader',
|
|
133
|
-
{
|
|
134
|
-
loader: 'image-webpack-loader',
|
|
135
|
-
options: {
|
|
136
|
-
gifsicle: {
|
|
137
|
-
enabled: false,
|
|
138
|
-
},
|
|
139
|
-
},
|
|
140
|
-
},
|
|
141
|
-
],
|
|
142
|
-
enforce: 'pre',
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
test: /\.(js|ts|jsx|tsx)$/,
|
|
130
|
+
test: /\.[jt]sx?$/,
|
|
146
131
|
enforce: 'pre',
|
|
147
132
|
exclude: /node_modules/,
|
|
148
133
|
resolve: {
|
|
@@ -159,7 +144,7 @@ module.exports = (options) => ({
|
|
|
159
144
|
],
|
|
160
145
|
},
|
|
161
146
|
{
|
|
162
|
-
test: /\.
|
|
147
|
+
test: /\.[j]sx?$/,
|
|
163
148
|
exclude: excludeNodeModulesExcept(modulesToTranspile),
|
|
164
149
|
resolve: {
|
|
165
150
|
fullySpecified: false,
|
|
@@ -168,12 +153,12 @@ module.exports = (options) => ({
|
|
|
168
153
|
loader: 'esbuild-loader',
|
|
169
154
|
options: {
|
|
170
155
|
loader: 'jsx',
|
|
171
|
-
target:
|
|
156
|
+
target: esBuild.target,
|
|
172
157
|
},
|
|
173
158
|
},
|
|
174
159
|
},
|
|
175
160
|
{
|
|
176
|
-
test: /\.
|
|
161
|
+
test: /\.[t]sx?$/,
|
|
177
162
|
exclude: excludeNodeModulesExcept(modulesToTranspile),
|
|
178
163
|
resolve: {
|
|
179
164
|
fullySpecified: false,
|
|
@@ -182,7 +167,7 @@ module.exports = (options) => ({
|
|
|
182
167
|
loader: 'esbuild-loader',
|
|
183
168
|
options: {
|
|
184
169
|
loader: 'tsx',
|
|
185
|
-
target:
|
|
170
|
+
target: esBuild.target,
|
|
186
171
|
},
|
|
187
172
|
},
|
|
188
173
|
},
|
|
@@ -221,27 +206,13 @@ module.exports = (options) => ({
|
|
|
221
206
|
type: 'asset/resource',
|
|
222
207
|
},
|
|
223
208
|
{
|
|
224
|
-
test: /\.svg
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
loader: '@svgr/webpack',
|
|
229
|
-
},
|
|
230
|
-
{
|
|
231
|
-
loader: 'file-loader',
|
|
232
|
-
options: {
|
|
233
|
-
name: getMediaPath(),
|
|
234
|
-
},
|
|
235
|
-
},
|
|
236
|
-
],
|
|
237
|
-
},
|
|
238
|
-
{
|
|
239
|
-
test: /\.(jpe?g|png|gif|ico)$/i,
|
|
240
|
-
exclude: excludeNodeModulesExcept(['@elliemae/*']),
|
|
241
|
-
type: 'asset',
|
|
209
|
+
test: /\.svg$/i,
|
|
210
|
+
issuer: /\.[jt]sx?$/,
|
|
211
|
+
resourceQuery: /^((?!url).)*$/,
|
|
212
|
+
use: ['@svgr/webpack'],
|
|
242
213
|
},
|
|
243
214
|
{
|
|
244
|
-
test: /\.(mp4|webm)
|
|
215
|
+
test: /\.(jpe?g|png|gif|ico|mp4|webm)$/i,
|
|
245
216
|
exclude: excludeNodeModulesExcept(['@elliemae/*']),
|
|
246
217
|
type: 'asset',
|
|
247
218
|
},
|
|
@@ -249,6 +220,10 @@ module.exports = (options) => ({
|
|
|
249
220
|
resourceQuery: /resource/,
|
|
250
221
|
type: 'asset/resource',
|
|
251
222
|
},
|
|
223
|
+
{
|
|
224
|
+
type: 'asset',
|
|
225
|
+
resourceQuery: /url/,
|
|
226
|
+
},
|
|
252
227
|
],
|
|
253
228
|
},
|
|
254
229
|
plugins: plugins.concat(options.plugins),
|
|
@@ -257,7 +232,6 @@ module.exports = (options) => ({
|
|
|
257
232
|
extensions: ['.wasm', '.mjs', '.ts', '.tsx', '.js', '.jsx', '.json'],
|
|
258
233
|
mainFields: ['browser', 'module', 'main'],
|
|
259
234
|
alias: {
|
|
260
|
-
'lodash-es': 'lodash',
|
|
261
235
|
...getAlias(),
|
|
262
236
|
...((options.resolve || {}).alias || {}),
|
|
263
237
|
},
|
|
@@ -268,6 +242,6 @@ module.exports = (options) => ({
|
|
|
268
242
|
'@elliemae/pui-diagnostics': 'emuiDiagnostics',
|
|
269
243
|
},
|
|
270
244
|
devtool: options.devtool || 'eval-source-map',
|
|
271
|
-
target: 'web',
|
|
245
|
+
target: 'web',
|
|
272
246
|
performance: options.performance || {},
|
|
273
247
|
});
|
|
@@ -72,6 +72,7 @@ const devConfig = {
|
|
|
72
72
|
|
|
73
73
|
// Add development plugins
|
|
74
74
|
plugins: [
|
|
75
|
+
new webpack.ProgressPlugin(),
|
|
75
76
|
new webpack.HotModuleReplacementPlugin(), // Tell webpack we want hot reloading
|
|
76
77
|
new ReactRefreshWebpackPlugin({
|
|
77
78
|
overlay: {
|
|
@@ -79,6 +80,7 @@ const devConfig = {
|
|
|
79
80
|
},
|
|
80
81
|
}),
|
|
81
82
|
new HtmlWebpackPlugin({
|
|
83
|
+
scriptLoading: 'module',
|
|
82
84
|
inject: !isAppLoaderEnabled(), // Inject all files that are generated by webpack, e.g. bundle.js
|
|
83
85
|
template: !isAppLoaderEnabled()
|
|
84
86
|
? 'app/index.html'
|
|
@@ -105,8 +107,6 @@ const devConfig = {
|
|
|
105
107
|
}),
|
|
106
108
|
],
|
|
107
109
|
|
|
108
|
-
// Emit a source map for easier debugging
|
|
109
|
-
// See https://webpack.js.org/configuration/devtool/#devtool
|
|
110
110
|
devtool: 'eval-source-map',
|
|
111
111
|
|
|
112
112
|
performance: {
|