@elliemae/pui-cli 6.0.0-beta.15 → 6.0.0-beta.16

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/esbuild.js CHANGED
@@ -1,6 +1,7 @@
1
1
  const esbuild = require('esbuild');
2
2
  const fg = require('fast-glob');
3
3
  const fs = require('fs');
4
+ const svgrPlugin = require('esbuild-plugin-svgr');
4
5
 
5
6
  const ESBUILD_TARGET = 'es2020';
6
7
 
@@ -9,6 +10,7 @@ const commonConfig = {
9
10
  target: ESBUILD_TARGET,
10
11
  loader: { '.js': 'jsx' },
11
12
  mainFields: ['module', 'browser', 'main'],
13
+ plugins: [svgrPlugin()],
12
14
  };
13
15
 
14
16
  const distFolder = 'dist';
@@ -43,7 +43,7 @@ const getAdditionalPlugins = () => [
43
43
  }),
44
44
  ];
45
45
 
46
- const getModulePreRules = () => [
46
+ const getModuleRules = () => [
47
47
  {
48
48
  test: /\.(js|ts|jsx|tsx)$/,
49
49
  enforce: 'pre',
@@ -61,11 +61,24 @@ const getModulePreRules = () => [
61
61
  },
62
62
  ],
63
63
  },
64
+ {
65
+ type: 'asset',
66
+ resourceQuery: /url/, // *.svg?react
67
+ },
68
+ {
69
+ test: /\.svg$/i,
70
+ issuer: /\.[jt]sx?$/,
71
+ use: ['@svgr/webpack'],
72
+ },
64
73
  ];
65
74
 
66
75
  exports.webpackFinal = async (config, { configType }) => {
67
76
  const isProd = configType === 'PRODUCTION';
68
- config.module.rules.push(...getModulePreRules());
77
+ const fileLoaderRule = config.module.rules.find((rule) =>
78
+ rule.test?.test?.('.svg'),
79
+ );
80
+ fileLoaderRule.exclude = /\.svg$/i;
81
+ config.module.rules.unshift(...getModuleRules());
69
82
  config.plugins.push(...getAdditionalPlugins());
70
83
  if (isProd) {
71
84
  config.plugins = config.plugins.concat(getCompressionPlugins());
@@ -73,7 +86,7 @@ exports.webpackFinal = async (config, { configType }) => {
73
86
 
74
87
  config.resolve.alias = { ...config.resolve.alias, ...getAlias() };
75
88
  config.resolve.fallback = { ...config.resolve.fallback, crypto: false };
76
-
89
+ config.resolve.extensions.push('.svg');
77
90
  config.externals = config.externals || {};
78
91
  config.externals['@elliemae/pui-user-monitoring'] = 'emuiUserMonitoring';
79
92
  config.externals['@elliemae/pui-app-loader'] = 'emuiAppLoader';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/pui-cli",
3
- "version": "6.0.0-beta.15",
3
+ "version": "6.0.0-beta.16",
4
4
  "private": false,
5
5
  "description": "EllieMae Platform UI CLI",
6
6
  "sideEffects": false,
@@ -128,6 +128,7 @@
128
128
  "esbuild": "~0.14.1",
129
129
  "esbuild-jest": "~0.5.0",
130
130
  "esbuild-loader": "~2.16.0",
131
+ "esbuild-plugin-svgr": "~0.0.3",
131
132
  "eslint": "~8.3.0",
132
133
  "eslint-config-airbnb": "~18.2.1",
133
134
  "eslint-config-airbnb-base": "~15.0.0",