@shopgate/webpack 7.30.0-alpha.7 → 7.30.0-alpha.9

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/i18n.js CHANGED
@@ -36,7 +36,7 @@ function readJSON(file) {
36
36
  */
37
37
  function flatten(obj, prefix = '', out = {}) {
38
38
  const result = out;
39
- // eslint-disable-next-line no-restricted-syntax
39
+
40
40
  for (const [key, value] of Object.entries(obj)) {
41
41
  const fullKey = prefix ? `${prefix}.${key}` : key;
42
42
  if (value && typeof value === 'object' && !Array.isArray(value)) {
package/lib/polyfill.js CHANGED
@@ -1,49 +1 @@
1
1
  window.SGEvent = {}
2
-
3
- // https://github.com/uxitten/polyfill/blob/master/string.polyfill.js
4
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padEnd
5
- if (!String.prototype.padEnd) {
6
- String.prototype.padEnd = function padEnd(targetLength, padString) {
7
- // Floor if number or convert non-number to 0
8
- targetLength = targetLength >> 0
9
- padString = String(padString || ' ')
10
- if (this.length > targetLength) {
11
- return String(this)
12
- } else {
13
- targetLength = targetLength - this.length
14
-
15
- if (targetLength > padString.length) {
16
- // Append to original to ensure we are longer than needed.
17
- padString += padString.repeat(targetLength / padString.length)
18
- }
19
-
20
- return String(this) + padString.slice(0, targetLength)
21
- }
22
- }
23
- }
24
-
25
- if (!Array.prototype.flat) {
26
- Array.prototype.flat = function(depth) {
27
- var flattened = [];
28
-
29
- function flatten(arr, currentDepth) {
30
- for (var i = 0; i < arr.length; i++) {
31
- if (Array.isArray(arr[i]) && currentDepth < depth) {
32
- flatten(arr[i], currentDepth + 1);
33
- } else {
34
- flattened.push(arr[i]);
35
- }
36
- }
37
- }
38
-
39
- flatten(this, 0);
40
-
41
- return flattened;
42
- };
43
- }
44
-
45
- if (!Array.prototype.flatMap) {
46
- Array.prototype.flatMap = function(callback, thisArg) {
47
- return this.map(callback, thisArg).flat();
48
- };
49
- }
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@shopgate/webpack",
3
- "version": "7.30.0-alpha.7",
3
+ "version": "7.30.0-alpha.9",
4
4
  "description": "The webpack configuration for Shopgate's Engage.",
5
5
  "main": "webpack.config.js",
6
6
  "license": "Apache-2.0",
7
7
  "dependencies": {
8
8
  "@pmmmwh/react-refresh-webpack-plugin": "0.5.17",
9
9
  "ajv": "^8.17.1",
10
- "babel-loader": "8.4.1",
10
+ "babel-loader": "^9.2.1",
11
11
  "chalk": "^4.1.2",
12
12
  "color": "^4.2.3",
13
13
  "compression-webpack-plugin": "^10.0.0",
package/webpack.config.js CHANGED
@@ -42,6 +42,7 @@ const addBundleAnalyzer = !!process.env.BUNDLE_ANALYZER;
42
42
  */
43
43
  const config = {
44
44
  mode: ENV,
45
+ target: ['web', 'browserslist'],
45
46
  entry: {
46
47
  app: {
47
48
  import: [
@@ -229,6 +230,21 @@ const config = {
229
230
  test: /\.mjs$/,
230
231
  type: 'javascript/auto',
231
232
  },
233
+ // Special treatment for PWA Extension Kit to ensure compatibility with current Babel setup
234
+ // https://github.com/shopgate-professional-services/pwa-extension-kit
235
+ {
236
+ test: /\.js$/,
237
+ include: /node_modules\/@shopgate-ps\/pwa-extension-kit/,
238
+ use: {
239
+ loader: 'babel-loader',
240
+ options: {
241
+ presets: [
242
+ ['@babel/preset-env', { modules: 'commonjs' }],
243
+ '@babel/preset-react',
244
+ ],
245
+ },
246
+ },
247
+ },
232
248
  {
233
249
  test: /\.(js|jsx)$/,
234
250
  exclude: new RegExp(`node_modules\\b(?!\\${path.sep}@shopgate)\\b.*`),