@shopgate/webpack 7.34.0-beta.2 → 7.34.0-beta.4

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/webpack.config.js +32 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopgate/webpack",
3
- "version": "7.34.0-beta.2",
3
+ "version": "7.34.0-beta.4",
4
4
  "description": "The webpack configuration for Shopgate's Engage.",
5
5
  "main": "webpack.config.js",
6
6
  "license": "Apache-2.0",
package/webpack.config.js CHANGED
@@ -41,6 +41,9 @@ const typeCheckPlugin = isDev && typeCheck
41
41
  ? new ShopgateTypeCheckPlugin({ overlay: typeCheck === 'overlay' })
42
42
  : null;
43
43
 
44
+ // Matches node_modules files, except the ones of @shopgate packages
45
+ const thirdPartyModules = new RegExp(`node_modules\\b(?!\\${path.sep}@shopgate)\\b.*`);
46
+
44
47
  /**
45
48
  * @type {import('webpack').Configuration}
46
49
  */
@@ -266,7 +269,7 @@ const config = {
266
269
  },
267
270
  {
268
271
  test: /\.(js|jsx|ts|tsx)$/,
269
- exclude: new RegExp(`node_modules\\b(?!\\${path.sep}@shopgate)\\b.*`),
272
+ exclude: thirdPartyModules,
270
273
  use: [
271
274
  {
272
275
  loader: 'babel-loader',
@@ -278,6 +281,34 @@ const config = {
278
281
  },
279
282
  ],
280
283
  },
284
+ // Transpile third-party packages for the browserslist targets, since packages may ship
285
+ // syntax that older browsers can't parse (e.g. class static blocks need iOS 16.4).
286
+ // Syntax only, polyfills are added for the project code by the theme's Babel config.
287
+ {
288
+ test: /\.(js|mjs|cjs)$/,
289
+ include: thirdPartyModules,
290
+ // Babel's own helpers, transpiling them can make them import themselves
291
+ exclude: /@babel[\\/]runtime[\\/]/,
292
+ use: [
293
+ {
294
+ loader: 'babel-loader',
295
+ options: {
296
+ babelrc: false,
297
+ configFile: false,
298
+ sourceType: 'unambiguous',
299
+ presets: [
300
+ ['@babel/preset-env', {
301
+ modules: false,
302
+ bugfixes: true,
303
+ useBuiltIns: false,
304
+ }],
305
+ ],
306
+ cacheDirectory: path.resolve(themePath, '..', '..', '.cache-loader'),
307
+ compact: true,
308
+ },
309
+ },
310
+ ],
311
+ },
281
312
  {
282
313
  test: /\.js$/,
283
314
  include: /@babel\/runtime[\\/]+helpers[\\/]esm/,