@dr.pogodin/react-utils 1.43.27 → 1.43.28

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.
@@ -125,7 +125,7 @@ const utils_1 = require("@dr.pogodin/babel-plugin-react-css-modules/utils");
125
125
  * - **`timestamp`** — The value set for `BUILD_TIMESTAMP`.
126
126
  */
127
127
  function configFactory(ops) {
128
- var _a, _b;
128
+ var _a, _b, _c;
129
129
  const o = (0, lodash_1.defaults)((0, lodash_1.clone)(ops), {
130
130
  babelLoaderOptions: {},
131
131
  cssLocalIdent: '[hash:base64:6]',
@@ -211,7 +211,7 @@ function configFactory(ops) {
211
211
  o.workbox = {};
212
212
  plugins.push(new workbox_webpack_plugin_1.default.InjectManifest(Object.assign(Object.assign({ swSrc: node_path_1.default.resolve(__dirname, '../workbox/default.js') }, o.workbox), { swDest: '__service-worker.js' })));
213
213
  }
214
- return {
214
+ const res = {
215
215
  context: o.context,
216
216
  entry,
217
217
  mode: o.mode,
@@ -302,12 +302,6 @@ function configFactory(ops) {
302
302
  plugins,
303
303
  resolve: {
304
304
  alias: {
305
- // NOTE: The "conditionNames" workaround below messes up the loading of
306
- // Babel's runtime helper for require of CJS and ES styles of modules
307
- // (without this alias it is resolved to
308
- // @babel/runtime/helpers/esm/interopRequireDefault, which has
309
- // the hepler function attached to "default" export).
310
- '@babel/runtime/helpers/interopRequireDefault': node_path_1.default.resolve(o.context, 'node_modules/@babel/runtime/helpers/interopRequireDefault'),
311
305
  // Aliases to JS an JSX files are handled by Babel.
312
306
  assets: node_path_1.default.resolve(o.context, 'src/assets'),
313
307
  components: node_path_1.default.resolve(o.context, 'src/shared/components'),
@@ -333,4 +327,26 @@ function configFactory(ops) {
333
327
  symlinks: false,
334
328
  },
335
329
  };
330
+ // TODO: Can we do anything better about it? Otherwise, we potentially
331
+ // have to alias all Babel's runtime helpers, otherwise if it tries to
332
+ // use a new helper it breaks (probably only production) build in a very
333
+ // confusing, hard to debug way. Not sure what to do, as the problem with
334
+ // RR exports is still there, and we still can't fully move to ES modules
335
+ // because Jest and other tools. Also such aliases easily break E2E tests
336
+ // with Jest (with our setup), that's why they are avoided when NODE_ENV
337
+ // is test (but it might be not the solution that always helps).
338
+ //
339
+ // NOTE: The "conditionNames" workaround below messes up the loading of
340
+ // Babel's runtime helper for require of CJS and ES styles of modules
341
+ // (without this alias it is resolved to
342
+ // @babel/runtime/helpers/esm/interopRequireDefault, which has
343
+ // the hepler function attached to "default" export).
344
+ if (process.env.NODE_ENV !== 'test') {
345
+ const aliases = (_c = res.resolve) === null || _c === void 0 ? void 0 : _c.alias;
346
+ aliases['@babel/runtime/helpers/defineProperty']
347
+ = node_path_1.default.resolve(o.context, 'node_modules/@babel/runtime/helpers/defineProperty');
348
+ aliases['@babel/runtime/helpers/interopRequireDefault']
349
+ = node_path_1.default.resolve(o.context, 'node_modules/@babel/runtime/helpers/interopRequireDefault');
350
+ }
351
+ return res;
336
352
  }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.43.27",
2
+ "version": "1.43.28",
3
3
  "bin": {
4
4
  "react-utils-build": "bin/build.js",
5
5
  "react-utils-setup": "bin/setup.js"
@@ -11,7 +11,7 @@
11
11
  "@babel/runtime": "^7.27.4",
12
12
  "@dr.pogodin/babel-plugin-react-css-modules": "^6.13.6",
13
13
  "@dr.pogodin/csurf": "^1.16.5",
14
- "@dr.pogodin/js-utils": "^0.1.1",
14
+ "@dr.pogodin/js-utils": "^0.1.3",
15
15
  "@dr.pogodin/react-global-state": "^0.19.3",
16
16
  "@dr.pogodin/react-helmet": "^3.0.2",
17
17
  "@dr.pogodin/react-themes": "^1.9.2",
@@ -55,7 +55,7 @@
55
55
  "@babel/preset-typescript": "^7.27.1",
56
56
  "@babel/register": "^7.27.1",
57
57
  "@dr.pogodin/babel-plugin-transform-assets": "^1.2.5",
58
- "@dr.pogodin/babel-preset-svgr": "^1.9.1",
58
+ "@dr.pogodin/babel-preset-svgr": "^1.9.2",
59
59
  "@dr.pogodin/eslint-configs": "^0.0.9",
60
60
  "@pmmmwh/react-refresh-webpack-plugin": "^0.6.1",
61
61
  "@testing-library/dom": "^10.4.0",