@commercetools-frontend/mc-scripts 21.7.0 → 21.9.0

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 (152) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -42
  3. package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.cjs.d.ts +1 -0
  4. package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.cjs.dev.js +7 -0
  5. package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.cjs.js +7 -0
  6. package/{build/config/application-runtime.js → application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.cjs.prod.js} +2 -2
  7. package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.esm.js +5 -0
  8. package/application-runtime/package.json +4 -0
  9. package/bin/cli.js +1 -1
  10. package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.d.ts +1 -0
  11. package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.dev.js +361 -0
  12. package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.js +7 -0
  13. package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.prod.js +361 -0
  14. package/cli/dist/commercetools-frontend-mc-scripts-cli.esm.js +345 -0
  15. package/cli/package.json +4 -0
  16. package/config/create-webpack-config-for-development.js +7 -1
  17. package/config/create-webpack-config-for-production.js +7 -1
  18. package/config/vendors-to-transpile.js +5 -1
  19. package/dist/build-5357ad26.cjs.prod.js +224 -0
  20. package/dist/build-9b6d7eee.cjs.dev.js +224 -0
  21. package/dist/build-c483e87f.esm.js +209 -0
  22. package/dist/build-vite-3b82522e.cjs.dev.js +151 -0
  23. package/dist/build-vite-93abdc95.esm.js +139 -0
  24. package/dist/build-vite-b7cd993a.cjs.prod.js +151 -0
  25. package/dist/commercetools-frontend-mc-scripts.cjs.d.ts +1 -0
  26. package/dist/commercetools-frontend-mc-scripts.cjs.dev.js +30 -0
  27. package/dist/commercetools-frontend-mc-scripts.cjs.js +7 -0
  28. package/dist/commercetools-frontend-mc-scripts.cjs.prod.js +30 -0
  29. package/dist/commercetools-frontend-mc-scripts.esm.js +22 -0
  30. package/dist/compile-html-4361a0b3.esm.js +77 -0
  31. package/dist/compile-html-d6331c35.cjs.prod.js +87 -0
  32. package/dist/compile-html-d9e731aa.cjs.dev.js +87 -0
  33. package/dist/config-sync-6b31d972.esm.js +840 -0
  34. package/dist/config-sync-a478bc0f.cjs.dev.js +864 -0
  35. package/dist/config-sync-f07734e4.cjs.prod.js +859 -0
  36. package/{build/config/create-postcss-config.js → dist/create-postcss-config-04243dea.esm.js} +27 -25
  37. package/dist/create-postcss-config-760e2dc5.cjs.dev.js +90 -0
  38. package/dist/create-postcss-config-ddc3abee.cjs.prod.js +90 -0
  39. package/dist/create-webpack-config-for-development-76fdab59.cjs.prod.js +419 -0
  40. package/{build/config/create-webpack-config-for-development.js → dist/create-webpack-config-for-development-d93ae4b2.esm.js} +94 -57
  41. package/dist/create-webpack-config-for-development-dfd1c174.cjs.dev.js +419 -0
  42. package/{build/config/create-webpack-config-for-production.js → dist/create-webpack-config-for-production-9290479a.esm.js} +120 -54
  43. package/dist/create-webpack-config-for-production-bc8c1f37.cjs.dev.js +469 -0
  44. package/dist/create-webpack-config-for-production-d652ad1a.cjs.prod.js +469 -0
  45. package/dist/declarations/src/application-runtime.d.ts +1 -0
  46. package/dist/declarations/src/cli.d.ts +4 -0
  47. package/dist/declarations/src/commands/build-vite.d.ts +2 -0
  48. package/dist/declarations/src/commands/build.d.ts +2 -0
  49. package/dist/declarations/src/commands/compile-html.d.ts +3 -0
  50. package/dist/declarations/src/commands/config-sync.d.ts +3 -0
  51. package/dist/declarations/src/commands/login.d.ts +2 -0
  52. package/dist/declarations/src/commands/serve.d.ts +2 -0
  53. package/dist/declarations/src/commands/start-vite.d.ts +2 -0
  54. package/dist/declarations/src/commands/start.d.ts +2 -0
  55. package/dist/declarations/src/config/create-postcss-config.d.ts +4 -0
  56. package/dist/declarations/src/config/create-webpack-config-for-development.d.ts +10 -0
  57. package/dist/declarations/src/config/create-webpack-config-for-production.d.ts +10 -0
  58. package/dist/declarations/src/config/has-jsx-runtime.d.ts +2 -0
  59. package/dist/declarations/src/config/moment-locales.d.ts +2 -0
  60. package/dist/declarations/src/config/paths.d.ts +12 -0
  61. package/dist/declarations/src/config/vendors-to-transpile.d.ts +2 -0
  62. package/dist/declarations/src/config/webpack-dev-server.config.d.ts +6 -0
  63. package/dist/declarations/src/deprecated-entry-points.d.ts +7 -0
  64. package/dist/declarations/src/generated/core.d.ts +710 -0
  65. package/dist/declarations/src/generated/settings.d.ts +2485 -0
  66. package/dist/declarations/src/index.d.ts +3 -0
  67. package/dist/declarations/src/postcss.d.ts +1 -0
  68. package/dist/declarations/src/types.d.ts +82 -0
  69. package/dist/declarations/src/utils/auth.d.ts +6 -0
  70. package/dist/declarations/src/utils/credentials-storage.d.ts +11 -0
  71. package/dist/declarations/src/utils/get-config-diff.d.ts +3 -0
  72. package/dist/declarations/src/utils/graphql-requests.d.ts +80 -0
  73. package/dist/declarations/src/utils/user-agent.d.ts +2 -0
  74. package/dist/declarations/src/version.d.ts +2 -0
  75. package/dist/declarations/src/vite-plugins/vite-plugin-custom-application.d.ts +4 -0
  76. package/dist/declarations/src/vite-plugins/vite-plugin-dynamic-base-assets-globals.d.ts +3 -0
  77. package/dist/declarations/src/vite-plugins/vite-plugin-svgr.d.ts +3 -0
  78. package/dist/declarations/src/webpack-plugins/final-stats-writer-plugin.d.ts +12 -0
  79. package/dist/declarations/src/webpack-plugins/local-html-webpack-plugin.d.ts +5 -0
  80. package/dist/declarations/src/webpack.d.ts +2 -0
  81. package/dist/has-jsx-runtime-0b03b72e.cjs.prod.js +17 -0
  82. package/dist/has-jsx-runtime-3d4bb633.cjs.dev.js +17 -0
  83. package/{build/config/has-jsx-runtime.js → dist/has-jsx-runtime-8314226e.esm.js} +1 -3
  84. package/dist/login-7b7ae27e.esm.js +155 -0
  85. package/dist/login-b13f26e7.cjs.dev.js +165 -0
  86. package/dist/login-c11fb977.cjs.prod.js +165 -0
  87. package/dist/package-4b4fcf02.cjs.prod.js +139 -0
  88. package/dist/package-4c3e3fb7.cjs.dev.js +139 -0
  89. package/dist/package-8e6305bd.esm.js +137 -0
  90. package/dist/paths-16823f56.cjs.dev.js +55 -0
  91. package/dist/paths-76b66e74.cjs.prod.js +55 -0
  92. package/dist/paths-ed23d5a1.esm.js +46 -0
  93. package/dist/serve-12de323b.cjs.dev.js +70 -0
  94. package/dist/serve-784f4fcd.cjs.prod.js +70 -0
  95. package/dist/serve-d6b437b1.esm.js +62 -0
  96. package/dist/start-1b7dad90.cjs.prod.js +209 -0
  97. package/dist/start-45ca01f2.cjs.dev.js +209 -0
  98. package/dist/start-600d06a3.esm.js +194 -0
  99. package/dist/start-vite-22de08dc.cjs.dev.js +151 -0
  100. package/dist/start-vite-dc046cba.esm.js +138 -0
  101. package/dist/start-vite-fe13330b.cjs.prod.js +151 -0
  102. package/dist/user-agent-5f8ec93d.cjs.prod.js +106 -0
  103. package/dist/user-agent-ca628320.esm.js +94 -0
  104. package/dist/user-agent-ee57c98a.cjs.dev.js +106 -0
  105. package/dist/vendors-to-transpile-367e0ba8.cjs.prod.js +5 -0
  106. package/dist/vendors-to-transpile-68e03526.esm.js +3 -0
  107. package/dist/vendors-to-transpile-b51af5d3.cjs.dev.js +5 -0
  108. package/dist/vite-plugin-svgr-4205f2b5.cjs.dev.js +110 -0
  109. package/dist/vite-plugin-svgr-eb8524fa.esm.js +85 -0
  110. package/dist/vite-plugin-svgr-f3bbedbe.cjs.prod.js +110 -0
  111. package/package.json +56 -50
  112. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.d.ts +1 -0
  113. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.dev.js +14 -0
  114. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.js +7 -0
  115. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.prod.js +14 -0
  116. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.esm.js +6 -0
  117. package/postcss/package.json +4 -0
  118. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.d.ts +1 -0
  119. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.dev.js +51 -0
  120. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.js +7 -0
  121. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.prod.js +51 -0
  122. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.esm.js +42 -0
  123. package/webpack/package.json +4 -0
  124. package/build/bin/cli.js +0 -264
  125. package/build/commands/build-vite.js +0 -91
  126. package/build/commands/build.js +0 -140
  127. package/build/commands/compile-html.js +0 -53
  128. package/build/commands/config-sync.js +0 -176
  129. package/build/commands/login.js +0 -60
  130. package/build/commands/serve.js +0 -37
  131. package/build/commands/start-vite.js +0 -138
  132. package/build/commands/start.js +0 -108
  133. package/build/config/paths.js +0 -38
  134. package/build/config/vendors-to-transpile.js +0 -3
  135. package/build/config/webpack-dev-server.config.js +0 -69
  136. package/build/index.js +0 -16
  137. package/build/utils/auth.js +0 -34
  138. package/build/utils/auth.spec.js +0 -61
  139. package/build/utils/create-custom-application.settings.graphql +0 -8
  140. package/build/utils/credentials-storage.js +0 -72
  141. package/build/utils/credentials-storage.spec.js +0 -69
  142. package/build/utils/fetch-custom-application.settings.graphql +0 -36
  143. package/build/utils/fetch-user-organizations.core.graphql +0 -9
  144. package/build/utils/get-config-diff.js +0 -308
  145. package/build/utils/get-config-diff.spec.js +0 -285
  146. package/build/utils/graphql-requests.js +0 -105
  147. package/build/utils/graphql-requests.spec.js +0 -159
  148. package/build/utils/require-graphql.js +0 -15
  149. package/build/utils/update-custom-application.settings.graphql +0 -13
  150. package/build/utils/user-agent.js +0 -15
  151. package/build/webpack-plugins/final-stats-writer-plugin.js +0 -50
  152. package/build/webpack-plugins/local-html-webpack-plugin.js +0 -38
@@ -1,35 +1,76 @@
1
- "use strict";
1
+ import _Object$keys from '@babel/runtime-corejs3/core-js-stable/object/keys';
2
+ import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
3
+ import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor';
4
+ import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/for-each';
5
+ import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors';
6
+ import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/object/define-properties';
7
+ import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
8
+ import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
9
+ import _mapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/map';
10
+ import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/filter';
11
+ import _JSON$stringify from '@babel/runtime-corejs3/core-js-stable/json/stringify';
12
+ import _endsWithInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/ends-with';
13
+ import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
14
+ import path from 'path';
15
+ import webpack from 'webpack';
16
+ import WebpackBar from 'webpackbar';
17
+ import HtmlWebpackPlugin from 'html-webpack-plugin';
18
+ import MomentLocalesPlugin from 'moment-locales-webpack-plugin';
19
+ import ReactRefreshWebpackPlugin from '@pmmmwh/react-refresh-webpack-plugin';
20
+ import _classCallCheck from '@babel/runtime-corejs3/helpers/esm/classCallCheck';
21
+ import _createClass from '@babel/runtime-corejs3/helpers/esm/createClass';
22
+ import _Object$assign from '@babel/runtime-corejs3/core-js-stable/object/assign';
23
+ import { processConfig } from '@commercetools-frontend/application-config';
24
+ import { replaceHtmlPlaceholders } from '@commercetools-frontend/mc-html-template';
25
+ import { p as paths } from './paths-ed23d5a1.esm.js';
26
+ import { v as vendorsToTranspile } from './vendors-to-transpile-68e03526.esm.js';
27
+ import { c as createPostcssConfig } from './create-postcss-config-04243dea.esm.js';
28
+ import { h as hasJsxRuntime } from './has-jsx-runtime-8314226e.esm.js';
2
29
 
3
- /* eslint-disable prettier/prettier */
4
- const path = require('path');
30
+ var LocalHtmlWebpackPlugin = /*#__PURE__*/function () {
31
+ function LocalHtmlWebpackPlugin() {
32
+ _classCallCheck(this, LocalHtmlWebpackPlugin);
33
+ }
5
34
 
6
- const webpack = require('webpack');
35
+ _createClass(LocalHtmlWebpackPlugin, [{
36
+ key: "apply",
37
+ value: function apply(compiler) {
38
+ compiler.hooks.compilation.tap('LocalHtmlWebpackPlugin', function (compilation) {
39
+ HtmlWebpackPlugin.getHooks(compilation).beforeEmit.tapAsync('LocalHtmlWebpackPlugin', function (data, cb) {
40
+ var applicationConfig = processConfig();
7
41
 
8
- const WebpackBar = require('webpackbar');
42
+ var enhancedLocalEnv = _Object$assign({}, applicationConfig.env, // Now that the app config is defined as a `env.json`, when we start the FE app
43
+ // to point to the local backend API by passing the `MC_API_URL` env does not
44
+ // work anymore). To make it work again, we can override the `env.json` config
45
+ // with the env variable before injecting the values into the index.html.
46
+ // NOTE: this is only necessary for development.
47
+ process.env.MC_API_URL ? {
48
+ mcApiUrl: process.env.MC_API_URL
49
+ } : {});
9
50
 
10
- const HtmlWebpackPlugin = require('html-webpack-plugin');
11
-
12
- const MomentLocalesPlugin = require('moment-locales-webpack-plugin');
13
-
14
- const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
15
-
16
- const paths = require('./paths');
51
+ data.html = replaceHtmlPlaceholders(data.html, {
52
+ env: enhancedLocalEnv,
53
+ headers: {}
54
+ });
55
+ cb(null, data);
56
+ });
57
+ });
58
+ }
59
+ }]);
17
60
 
18
- const vendorsToTranspile = require('./vendors-to-transpile');
61
+ return LocalHtmlWebpackPlugin;
62
+ }();
19
63
 
20
- const createPostcssConfig = require('./create-postcss-config');
64
+ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
21
65
 
22
- const hasJsxRuntime = require('./has-jsx-runtime');
66
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context6, _context7; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context6 = ownKeys(Object(source), !0)).call(_context6, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context7 = ownKeys(Object(source))).call(_context7, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
23
67
 
24
- const defaultToggleFlags = {
25
- // Allow to disable index.html generation in case it's not necessary (e.g. for Storybook)
68
+ var momentLocalesToKeep = ["de", "de-at", "de-ch", "en-au", "en-ca", "en-gb", "en-ie", "en-in", "en-nz", "en-sg", "es", "es-do", "es-mx", "fr", "ja", "zh-cn"];
69
+ var defaultToggleFlags = {
26
70
  generateIndexHtml: true,
27
- // Some environemnts do not require `core-js` and can hence disable
28
- // it explicitely. This will disable `core-js` for `preset-env` and the
29
- // `plugin-transform-runtime`.
30
71
  disableCoreJs: false
31
72
  };
32
- const defaultOptions = {
73
+ var defaultOptions = {
33
74
  entryPoint: paths.entryPoint,
34
75
  sourceFolders: paths.sourceFolders,
35
76
  postcssOptions: {},
@@ -37,32 +78,28 @@ const defaultOptions = {
37
78
  }; // Whether or not `react-refresh` is enabled, `react-refresh` is not 100% stable at this time,
38
79
  // which is why it's disabled by default.
39
80
 
40
- const hasReactRefresh = process.env.FAST_REFRESH === 'true';
81
+ var hasReactRefresh = process.env.FAST_REFRESH === 'true';
41
82
 
42
- const webpackDevClientEntry = require.resolve('react-dev-utils/webpackHotDevClient');
83
+ var webpackDevClientEntry = require.resolve('react-dev-utils/webpackHotDevClient');
43
84
 
44
- const reactRefreshOverlayEntry = require.resolve('react-dev-utils/refreshOverlayInterop');
85
+ var reactRefreshOverlayEntry = require.resolve('react-dev-utils/refreshOverlayInterop');
45
86
  /**
46
87
  * This is a factory function to create the default webpack config
47
88
  * for a MC Application in `development` mode.
48
89
  * The function requires the file path to the related application
49
90
  * "entry point".
50
- *
51
- * @param {Object} options - Options to configure the Webpack config
52
- * @param {string} options.entryPoint - The absolute path to the application entry point file.
53
- * @param {string[]} options.sourceFolders[] - A list of folders where Webpack should look for source files.
54
- * @param {Object} options.postcssOptions - Options related to Postcss plugins. See `createPostcssConfig` function.
55
- * @param {Object} options.toggleFlags - Options to enable/disable certain functionalities of the Webpack config.
56
91
  */
57
92
 
58
93
 
59
- module.exports = function createWebpackConfigForDevelopment(options = {}) {
60
- const mergedOptions = { ...defaultOptions,
61
- ...options,
62
- toggleFlags: { ...defaultToggleFlags,
63
- ...options.toggleFlags
64
- }
65
- };
94
+ function createWebpackConfigForDevelopment() {
95
+ var _context, _context2, _context3, _context4, _context5;
96
+
97
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
98
+
99
+ var mergedOptions = _objectSpread(_objectSpread(_objectSpread({}, defaultOptions), options), {}, {
100
+ toggleFlags: _objectSpread(_objectSpread({}, defaultToggleFlags), options.toggleFlags)
101
+ });
102
+
66
103
  return {
67
104
  // https://webpack.js.org/concepts/#mode
68
105
  mode: 'development',
@@ -96,7 +133,9 @@ module.exports = function createWebpackConfigForDevelopment(options = {}) {
96
133
  // https://github.com/facebook/create-react-app/issues/290
97
134
  // `web` extension prefixes have been added for better support
98
135
  // for React Native Web.
99
- extensions: ['js', 'mjs', 'cjs', 'ts', 'tsx', 'json', 'jsx'].map(ext => `.${ext}`),
136
+ extensions: _mapInstanceProperty(_context = ['js', 'mjs', 'cjs', 'ts', 'tsx', 'json', 'jsx']).call(_context, function (ext) {
137
+ return ".".concat(ext);
138
+ }),
100
139
  // NOTE: this is meant to be a temporary list of fallback/polyfills for certain
101
140
  // nodejs modules. With Webpack <5 these polyfills were included by default in Webpack,
102
141
  // however now it's not the case anymore.
@@ -107,7 +146,7 @@ module.exports = function createWebpackConfigForDevelopment(options = {}) {
107
146
  }
108
147
  },
109
148
  entry: {
110
- app: [require.resolve('./application-runtime'), !mergedOptions.toggleFlags.disableCoreJs && require.resolve('core-js/stable'), // When using the experimental `react-refresh` integration,
149
+ app: _filterInstanceProperty(_context2 = [require.resolve('@commercetools-frontend/mc-scripts/application-runtime'), !mergedOptions.toggleFlags.disableCoreJs && require.resolve('core-js/stable'), // When using the experimental `react-refresh` integration,
111
150
  // the webpack plugin takes care of injecting the dev client for us.
112
151
  !hasReactRefresh && // Include an alternative client for WebpackDevServer. A client's job is to
113
152
  // connect to WebpackDevServer by a socket and get notified about changes.
@@ -124,7 +163,7 @@ module.exports = function createWebpackConfigForDevelopment(options = {}) {
124
163
  mergedOptions.entryPoint // We include the app code last so that if there is a runtime error during
125
164
  // initialization, it doesn't blow up the WebpackDevServer client, and
126
165
  // changing JS code would still trigger a refresh.
127
- ].filter(Boolean)
166
+ ]).call(_context2, Boolean)
128
167
  },
129
168
  output: {
130
169
  // This does not produce a real file. It's just the virtual path that is
@@ -140,9 +179,11 @@ module.exports = function createWebpackConfigForDevelopment(options = {}) {
140
179
  // This is the URL that app is served from. We use "/" in development.
141
180
  publicPath: '/',
142
181
  // Point sourcemap entries to the original disk location (format as URL on Windows)
143
- devtoolModuleFilenameTemplate: info => path.resolve(info.absoluteResourcePath).replace(/\\/g, '/')
182
+ devtoolModuleFilenameTemplate: function devtoolModuleFilenameTemplate(info) {
183
+ return path.resolve(info.absoluteResourcePath).replace(/\\/g, '/');
184
+ }
144
185
  },
145
- plugins: [new WebpackBar(), // Allows to "assign" custom options to the `webpack` object.
186
+ plugins: _filterInstanceProperty(_context3 = [new WebpackBar(), // Allows to "assign" custom options to the `webpack` object.
146
187
  // At the moment, this is used to share some props with `postcss.config`.
147
188
  new webpack.LoaderOptionsPlugin({
148
189
  options: {
@@ -154,21 +195,15 @@ module.exports = function createWebpackConfigForDevelopment(options = {}) {
154
195
  new webpack.DefinePlugin({
155
196
  __DEV__: 'true',
156
197
  'process.env': {
157
- NODE_ENV: JSON.stringify('development')
198
+ NODE_ENV: _JSON$stringify('development')
158
199
  }
159
200
  }), mergedOptions.toggleFlags.generateIndexHtml && new HtmlWebpackPlugin({
160
201
  inject: false,
161
202
  filename: paths.appIndexHtml,
162
203
  template: require.resolve('@commercetools-frontend/mc-html-template/webpack')
163
- }), mergedOptions.toggleFlags.generateIndexHtml && (() => {
164
- // eslint-disable-next-line global-require
165
- const LocalHtmlWebpackPlugin = require('../webpack-plugins/local-html-webpack-plugin');
166
-
167
- return new LocalHtmlWebpackPlugin();
168
- })(), // Strip all locales except `en`, `de`
169
- // (`en` is built into Moment and can't be removed).
204
+ }), mergedOptions.toggleFlags.generateIndexHtml && new LocalHtmlWebpackPlugin(), // Only keep locales that are available in the Merchant Center.
170
205
  new MomentLocalesPlugin({
171
- localesToKeep: ['de', 'es', 'fr', 'zh-cn', 'ja']
206
+ localesToKeep: momentLocalesToKeep
172
207
  }), // This is necessary to emit hot updates (CSS and Fast Refresh):
173
208
  new webpack.HotModuleReplacementPlugin(), // Experimental hot reloading for React .
174
209
  // https://github.com/facebook/react/tree/master/packages/react-refresh
@@ -182,7 +217,7 @@ module.exports = function createWebpackConfigForDevelopment(options = {}) {
182
217
  // the bundled socket handling logic can be eliminated.
183
218
  sockIntegration: false
184
219
  }
185
- })].filter(Boolean),
220
+ })]).call(_context3, Boolean),
186
221
  module: {
187
222
  // Makes missing exports an error instead of warning.
188
223
  strictExportPresence: true,
@@ -227,7 +262,7 @@ module.exports = function createWebpackConfigForDevelopment(options = {}) {
227
262
  test: function testForNormalSvgFiles(fileName) {
228
263
  return (// Use this only for plain SVG.
229
264
  // For SVG as React components, see loader above.
230
- fileName.endsWith('.svg') && !fileName.endsWith('.react.svg')
265
+ _endsWithInstanceProperty(fileName).call(fileName, '.svg') && !_endsWithInstanceProperty(fileName).call(fileName, '.react.svg')
231
266
  );
232
267
  },
233
268
  use: [{
@@ -262,7 +297,7 @@ module.exports = function createWebpackConfigForDevelopment(options = {}) {
262
297
  test: function testForNormalCssFiles(fileName) {
263
298
  return (// Use this only for plain CSS.
264
299
  // For css-modules, see loader above.
265
- fileName.endsWith('.css') && !(fileName.endsWith('.mod.css') || fileName.endsWith('.module.css'))
300
+ _endsWithInstanceProperty(fileName).call(fileName, '.css') && !(_endsWithInstanceProperty(fileName).call(fileName, '.mod.css') || _endsWithInstanceProperty(fileName).call(fileName, '.module.css'))
266
301
  );
267
302
  },
268
303
  // "postcss" loader applies autoprefixer to our CSS.
@@ -327,7 +362,7 @@ module.exports = function createWebpackConfigForDevelopment(options = {}) {
327
362
  presets: [[require.resolve('@commercetools-frontend/babel-preset-mc-app'), {
328
363
  runtime: hasJsxRuntime() ? 'automatic' : 'classic'
329
364
  }]],
330
- plugins: [hasReactRefresh && require.resolve('react-refresh/babel')].filter(Boolean),
365
+ plugins: _filterInstanceProperty(_context4 = [hasReactRefresh && require.resolve('react-refresh/babel')]).call(_context4, Boolean),
331
366
  // This is a feature of `babel-loader` for webpack (not Babel itself).
332
367
  // It enables caching results in ./node_modules/.cache/babel-loader/
333
368
  // directory for faster rebuilds.
@@ -335,7 +370,7 @@ module.exports = function createWebpackConfigForDevelopment(options = {}) {
335
370
  highlightCode: true
336
371
  }
337
372
  }],
338
- include: mergedOptions.sourceFolders.concat(vendorsToTranspile),
373
+ include: _concatInstanceProperty(_context5 = mergedOptions.sourceFolders).call(_context5, vendorsToTranspile),
339
374
  // Disable require.ensure as it's not a standard language feature.
340
375
  parser: {
341
376
  requireEnsure: false
@@ -355,4 +390,6 @@ module.exports = function createWebpackConfigForDevelopment(options = {}) {
355
390
  level: 'none'
356
391
  }
357
392
  };
358
- };
393
+ }
394
+
395
+ export { createWebpackConfigForDevelopment as c };