@teambit/ui 0.0.880 → 0.0.882
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/dist/create-root.js +2 -26
- package/dist/create-root.js.map +1 -1
- package/dist/events/index.js +0 -2
- package/dist/events/index.js.map +1 -1
- package/dist/events/ui-server-started-event.js +1 -12
- package/dist/events/ui-server-started-event.js.map +1 -1
- package/dist/exceptions/index.js +0 -6
- package/dist/exceptions/index.js.map +1 -1
- package/dist/exceptions/unknown-build-error.js +0 -3
- package/dist/exceptions/unknown-build-error.js.map +1 -1
- package/dist/exceptions/unknown-ui.js +0 -5
- package/dist/exceptions/unknown-ui.js.map +1 -1
- package/dist/index.js +0 -14
- package/dist/index.js.map +1 -1
- package/dist/ssr-middleware/index.js +0 -3
- package/dist/ssr-middleware/index.js.map +1 -1
- package/dist/ssr-middleware/ssr-middleware.js +0 -39
- package/dist/ssr-middleware/ssr-middleware.js.map +1 -1
- package/dist/start.cmd.js +8 -30
- package/dist/start.cmd.js.map +1 -1
- package/dist/ui/client-context.js +1 -27
- package/dist/ui/client-context.js.map +1 -1
- package/dist/ui-build.cmd.js +0 -13
- package/dist/ui-build.cmd.js.map +1 -1
- package/dist/ui-server.js +22 -83
- package/dist/ui-server.js.map +1 -1
- package/dist/ui.aspect.js +0 -6
- package/dist/ui.aspect.js.map +1 -1
- package/dist/ui.cli.rt.js +1 -0
- package/dist/ui.cli.rt.js.map +1 -1
- package/dist/ui.composition.js +0 -6
- package/dist/ui.composition.js.map +1 -1
- package/dist/ui.main.runtime.js +15 -150
- package/dist/ui.main.runtime.js.map +1 -1
- package/dist/ui.runtime.js +1 -0
- package/dist/ui.runtime.js.map +1 -1
- package/dist/ui.ui.runtime.js +9 -49
- package/dist/ui.ui.runtime.js.map +1 -1
- package/dist/webpack/html.js +0 -1
- package/dist/webpack/html.js.map +1 -1
- package/dist/webpack/postcss.config.js +7 -3
- package/dist/webpack/postcss.config.js.map +1 -1
- package/dist/webpack/webpack.base.config.js +45 -65
- package/dist/webpack/webpack.base.config.js.map +1 -1
- package/dist/webpack/webpack.browser.config.js +3 -31
- package/dist/webpack/webpack.browser.config.js.map +1 -1
- package/dist/webpack/webpack.dev.config.js +25 -63
- package/dist/webpack/webpack.dev.config.js.map +1 -1
- package/dist/webpack/webpack.ssr.config.js +5 -14
- package/dist/webpack/webpack.ssr.config.js.map +1 -1
- package/package-tar/teambit-ui-0.0.882.tgz +0 -0
- package/package.json +15 -15
- package/{preview-1666312873430.js → preview-1666496165706.js} +2 -2
- package/package-tar/teambit-ui-0.0.880.tgz +0 -0
|
@@ -1,162 +1,122 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
require("core-js/modules/es.regexp.constructor.js");
|
|
6
|
-
|
|
7
5
|
require("core-js/modules/es.regexp.exec.js");
|
|
8
|
-
|
|
9
6
|
Object.defineProperty(exports, "__esModule", {
|
|
10
7
|
value: true
|
|
11
8
|
});
|
|
12
9
|
exports.default = createWebpackConfig;
|
|
13
|
-
|
|
14
10
|
function _defineProperty2() {
|
|
15
11
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
-
|
|
17
12
|
_defineProperty2 = function () {
|
|
18
13
|
return data;
|
|
19
14
|
};
|
|
20
|
-
|
|
21
15
|
return data;
|
|
22
16
|
}
|
|
23
|
-
|
|
24
17
|
function _lodash() {
|
|
25
18
|
const data = require("lodash");
|
|
26
|
-
|
|
27
19
|
_lodash = function () {
|
|
28
20
|
return data;
|
|
29
21
|
};
|
|
30
|
-
|
|
31
22
|
return data;
|
|
32
23
|
}
|
|
33
|
-
|
|
34
24
|
function _webpack() {
|
|
35
25
|
const data = _interopRequireDefault(require("webpack"));
|
|
36
|
-
|
|
37
26
|
_webpack = function () {
|
|
38
27
|
return data;
|
|
39
28
|
};
|
|
40
|
-
|
|
41
29
|
return data;
|
|
42
30
|
}
|
|
43
|
-
|
|
44
31
|
function _miniCssExtractPlugin() {
|
|
45
32
|
const data = _interopRequireDefault(require("mini-css-extract-plugin"));
|
|
46
|
-
|
|
47
33
|
_miniCssExtractPlugin = function () {
|
|
48
34
|
return data;
|
|
49
35
|
};
|
|
50
|
-
|
|
51
36
|
return data;
|
|
52
37
|
}
|
|
53
|
-
|
|
54
38
|
function _webpackManifestPlugin() {
|
|
55
39
|
const data = require("webpack-manifest-plugin");
|
|
56
|
-
|
|
57
40
|
_webpackManifestPlugin = function () {
|
|
58
41
|
return data;
|
|
59
42
|
};
|
|
60
|
-
|
|
61
43
|
return data;
|
|
62
44
|
}
|
|
63
|
-
|
|
64
45
|
function _workboxWebpackPlugin() {
|
|
65
46
|
const data = _interopRequireDefault(require("workbox-webpack-plugin"));
|
|
66
|
-
|
|
67
47
|
_workboxWebpackPlugin = function () {
|
|
68
48
|
return data;
|
|
69
49
|
};
|
|
70
|
-
|
|
71
50
|
return data;
|
|
72
51
|
}
|
|
73
|
-
|
|
74
52
|
function _getCSSModuleLocalIdent() {
|
|
75
53
|
const data = _interopRequireDefault(require("react-dev-utils/getCSSModuleLocalIdent"));
|
|
76
|
-
|
|
77
54
|
_getCSSModuleLocalIdent = function () {
|
|
78
55
|
return data;
|
|
79
56
|
};
|
|
80
|
-
|
|
81
57
|
return data;
|
|
82
58
|
}
|
|
83
|
-
|
|
84
59
|
function _path() {
|
|
85
60
|
const data = _interopRequireDefault(require("path"));
|
|
86
|
-
|
|
87
61
|
_path = function () {
|
|
88
62
|
return data;
|
|
89
63
|
};
|
|
90
|
-
|
|
91
64
|
return data;
|
|
92
65
|
}
|
|
93
|
-
|
|
94
66
|
function stylesRegexps() {
|
|
95
67
|
const data = _interopRequireWildcard(require("@teambit/webpack.modules.style-regexps"));
|
|
96
|
-
|
|
97
68
|
stylesRegexps = function () {
|
|
98
69
|
return data;
|
|
99
70
|
};
|
|
100
|
-
|
|
101
71
|
return data;
|
|
102
72
|
}
|
|
103
|
-
|
|
104
73
|
function _webpackModules2() {
|
|
105
74
|
const data = require("@teambit/webpack.modules.generate-style-loaders");
|
|
106
|
-
|
|
107
75
|
_webpackModules2 = function () {
|
|
108
76
|
return data;
|
|
109
77
|
};
|
|
110
|
-
|
|
111
78
|
return data;
|
|
112
79
|
}
|
|
113
|
-
|
|
114
80
|
function _webpack2() {
|
|
115
81
|
const data = require("@teambit/webpack");
|
|
116
|
-
|
|
117
82
|
_webpack2 = function () {
|
|
118
83
|
return data;
|
|
119
84
|
};
|
|
120
|
-
|
|
121
85
|
return data;
|
|
122
86
|
}
|
|
123
|
-
|
|
124
87
|
function _postcss() {
|
|
125
88
|
const data = require("./postcss.config");
|
|
126
|
-
|
|
127
89
|
_postcss = function () {
|
|
128
90
|
return data;
|
|
129
91
|
};
|
|
130
|
-
|
|
131
92
|
return data;
|
|
132
93
|
}
|
|
133
|
-
|
|
134
94
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
135
|
-
|
|
136
95
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
137
|
-
|
|
138
96
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
139
|
-
|
|
140
97
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2().default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
141
|
-
|
|
142
98
|
const baseStyleLoadersOptions = {
|
|
143
99
|
injectingLoader: _miniCssExtractPlugin().default.loader,
|
|
144
100
|
cssLoaderPath: require.resolve('css-loader'),
|
|
145
101
|
postCssLoaderPath: require.resolve('postcss-loader'),
|
|
146
102
|
postCssConfig: _postcss().postCssConfig
|
|
147
103
|
};
|
|
148
|
-
const moduleFileExtensions = ['web.mjs', 'mjs', 'web.js', 'js', 'web.ts', 'ts', 'web.tsx', 'tsx', 'json', 'web.jsx', 'jsx'];
|
|
104
|
+
const moduleFileExtensions = ['web.mjs', 'mjs', 'web.js', 'js', 'web.ts', 'ts', 'web.tsx', 'tsx', 'json', 'web.jsx', 'jsx'];
|
|
149
105
|
|
|
106
|
+
// Source maps are resource heavy and can cause out of memory issue for large source files.
|
|
150
107
|
const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false';
|
|
151
108
|
const imageInlineSizeLimit = parseInt(process.env.IMAGE_INLINE_SIZE_LIMIT || '10000');
|
|
152
|
-
const isEnvProduction = true;
|
|
109
|
+
const isEnvProduction = true;
|
|
110
|
+
|
|
111
|
+
// This is the production and development configuration.
|
|
153
112
|
// It is focused on developer experience, fast rebuilds, and a minimal bundle.
|
|
154
113
|
// eslint-disable-next-line complexity
|
|
155
|
-
|
|
156
114
|
function createWebpackConfig(workspaceDir, entryFiles, publicDir = 'public') {
|
|
157
115
|
// Variable used for enabling profiling in Production
|
|
158
116
|
// passed into alias object. Uses a flag if passed into the build command
|
|
159
|
-
const isEnvProductionProfile = process.argv.includes('--profile');
|
|
117
|
+
const isEnvProductionProfile = process.argv.includes('--profile');
|
|
118
|
+
|
|
119
|
+
// We will provide `paths.publicUrlOrPath` to our app
|
|
160
120
|
// as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.
|
|
161
121
|
// Omit trailing slash as %PUBLIC_URL%/xyz looks better than %PUBLIC_URL%xyz.
|
|
162
122
|
// Get environment variables to inject into our app.
|
|
@@ -175,16 +135,18 @@ function createWebpackConfig(workspaceDir, entryFiles, publicDir = 'public') {
|
|
|
175
135
|
// The build folder.
|
|
176
136
|
path: _path().default.join(workspaceDir, publicDir),
|
|
177
137
|
// default value
|
|
138
|
+
|
|
178
139
|
filename: 'static/js/[name].[contenthash:8].js',
|
|
179
140
|
// TODO: remove this when upgrading to webpack 5
|
|
180
141
|
// futureEmitAssets: true,
|
|
181
142
|
// There are also additional JS chunk files if you use code splitting.
|
|
182
|
-
chunkFilename: 'static/js/[name].[contenthash:8].chunk.js'
|
|
143
|
+
chunkFilename: 'static/js/[name].[contenthash:8].chunk.js'
|
|
144
|
+
// this defaults to 'window', but by setting it to 'this' then
|
|
183
145
|
// module chunks which are built will work in web workers as well.
|
|
184
146
|
// Commented out to use the default (self) as according to tobias with webpack5 self is working with workers as well
|
|
185
147
|
// globalObject: 'this',
|
|
186
|
-
|
|
187
148
|
},
|
|
149
|
+
|
|
188
150
|
resolve: {
|
|
189
151
|
// These are the reasonable defaults supported by the Node ecosystem.
|
|
190
152
|
// We also include JSX as a common component filename extension to support
|
|
@@ -223,13 +185,15 @@ function createWebpackConfig(workspaceDir, entryFiles, publicDir = 'public') {
|
|
|
223
185
|
resolve: {
|
|
224
186
|
fullySpecified: false
|
|
225
187
|
}
|
|
226
|
-
},
|
|
188
|
+
},
|
|
189
|
+
// Disable require.ensure as it's not a standard language feature.
|
|
227
190
|
// { parser: { requireEnsure: false } },
|
|
228
191
|
{
|
|
229
192
|
// "oneOf" will traverse all following loaders until one will
|
|
230
193
|
// match the requirements. When no loader matches it will fall
|
|
231
194
|
// back to the "file" loader at the end of the loader list.
|
|
232
|
-
oneOf: [
|
|
195
|
+
oneOf: [
|
|
196
|
+
// "postcss" loader applies autoprefixer to our CSS.
|
|
233
197
|
// "css" loader resolves paths in CSS and adds assets as dependencies.
|
|
234
198
|
// "style" loader turns CSS into JS modules that inject <style> tags.
|
|
235
199
|
// In production, we use MiniCSSExtractPlugin to extract that CSS
|
|
@@ -249,7 +213,8 @@ function createWebpackConfig(workspaceDir, entryFiles, publicDir = 'public') {
|
|
|
249
213
|
// Remove this when webpack adds a warning or an error for this.
|
|
250
214
|
// See https://github.com/webpack/webpack/issues/6571
|
|
251
215
|
sideEffects: true
|
|
252
|
-
},
|
|
216
|
+
},
|
|
217
|
+
// "url" loader works like "file" loader except that it embeds assets
|
|
253
218
|
// smaller than specified limit in bytes as data URLs to avoid requests.
|
|
254
219
|
// A missing `test` is equivalent to a match.
|
|
255
220
|
{
|
|
@@ -260,7 +225,8 @@ function createWebpackConfig(workspaceDir, entryFiles, publicDir = 'public') {
|
|
|
260
225
|
maxSize: imageInlineSizeLimit
|
|
261
226
|
}
|
|
262
227
|
}
|
|
263
|
-
},
|
|
228
|
+
},
|
|
229
|
+
// Process application JS with Babel.
|
|
264
230
|
// The preset includes JSX, Flow, TypeScript, and some ESnext features.
|
|
265
231
|
{
|
|
266
232
|
test: /\.(js|mjs|jsx|ts|tsx)$/,
|
|
@@ -277,7 +243,8 @@ function createWebpackConfig(workspaceDir, entryFiles, publicDir = 'public') {
|
|
|
277
243
|
cacheCompression: false,
|
|
278
244
|
compact: isEnvProduction
|
|
279
245
|
}
|
|
280
|
-
},
|
|
246
|
+
},
|
|
247
|
+
// Process any JS outside of the app with Babel.
|
|
281
248
|
// Unlike the application JS, we only compile the standard ES features.
|
|
282
249
|
// Probably not needed in our use case
|
|
283
250
|
// {
|
|
@@ -292,6 +259,7 @@ function createWebpackConfig(workspaceDir, entryFiles, publicDir = 'public') {
|
|
|
292
259
|
// cacheDirectory: true,
|
|
293
260
|
// // See #6846 for context on why cacheCompression is disabled
|
|
294
261
|
// cacheCompression: false,
|
|
262
|
+
|
|
295
263
|
// // Babel sourcemaps are needed for debugging into node_modules
|
|
296
264
|
// // code. Without the options below, debuggers like VSCode
|
|
297
265
|
// // show incorrect code and set breakpoints on the wrong lines.
|
|
@@ -299,6 +267,7 @@ function createWebpackConfig(workspaceDir, entryFiles, publicDir = 'public') {
|
|
|
299
267
|
// inputSourceMap: shouldUseSourceMap,
|
|
300
268
|
// },
|
|
301
269
|
// },
|
|
270
|
+
|
|
302
271
|
// Adds support for CSS Modules (https://github.com/css-modules/css-modules)
|
|
303
272
|
// using the extension .module.css
|
|
304
273
|
{
|
|
@@ -313,7 +282,8 @@ function createWebpackConfig(workspaceDir, entryFiles, publicDir = 'public') {
|
|
|
313
282
|
},
|
|
314
283
|
shouldUseSourceMap: isEnvProduction || shouldUseSourceMap
|
|
315
284
|
}))
|
|
316
|
-
},
|
|
285
|
+
},
|
|
286
|
+
// Opt-in support for SASS (using .scss or .sass extensions).
|
|
317
287
|
// By default we support SASS Modules with the
|
|
318
288
|
// extensions .module.scss or .module.sass
|
|
319
289
|
{
|
|
@@ -334,7 +304,8 @@ function createWebpackConfig(workspaceDir, entryFiles, publicDir = 'public') {
|
|
|
334
304
|
// Remove this when webpack adds a warning or an error for this.
|
|
335
305
|
// See https://github.com/webpack/webpack/issues/6571
|
|
336
306
|
sideEffects: true
|
|
337
|
-
},
|
|
307
|
+
},
|
|
308
|
+
// Adds support for CSS Modules, but using SASS
|
|
338
309
|
// using the extension .module.scss or .module.sass
|
|
339
310
|
{
|
|
340
311
|
test: stylesRegexps().sassModuleRegex,
|
|
@@ -386,7 +357,8 @@ function createWebpackConfig(workspaceDir, entryFiles, publicDir = 'public') {
|
|
|
386
357
|
preProcessorPath: require.resolve('less-loader')
|
|
387
358
|
}
|
|
388
359
|
}))
|
|
389
|
-
},
|
|
360
|
+
},
|
|
361
|
+
// "file" loader makes sure those assets get served by WebpackDevServer.
|
|
390
362
|
// When you `import` an asset, you get its (virtual) filename.
|
|
391
363
|
// In production, they would get copied to the `build` folder.
|
|
392
364
|
// This loader doesn't use a "test" so it will catch all modules
|
|
@@ -398,17 +370,20 @@ function createWebpackConfig(workspaceDir, entryFiles, publicDir = 'public') {
|
|
|
398
370
|
// by webpacks internal loaders.
|
|
399
371
|
exclude: [/\.(js|mjs|jsx|ts|tsx)$/, /\.html$/, /\.json$/, /\.css$/],
|
|
400
372
|
type: 'asset/resource'
|
|
401
|
-
}
|
|
373
|
+
}
|
|
374
|
+
// ** STOP ** Are you adding a new loader?
|
|
402
375
|
// Make sure to add the new loader(s) before the "file" loader.
|
|
403
376
|
]
|
|
404
377
|
}]
|
|
405
378
|
},
|
|
379
|
+
|
|
406
380
|
plugins: [new (_miniCssExtractPlugin().default)({
|
|
407
381
|
// Options similar to the same options in webpackOptions.output
|
|
408
382
|
// both options are optional
|
|
409
383
|
filename: 'static/css/[name].[contenthash:8].css',
|
|
410
384
|
chunkFilename: 'static/css/[name].[contenthash:8].chunk.css'
|
|
411
|
-
}),
|
|
385
|
+
}),
|
|
386
|
+
// Generate an asset manifest file with the following content:
|
|
412
387
|
// - "files" key: Mapping of all asset filenames to their corresponding
|
|
413
388
|
// output file so that tools can pick it up without having to parse
|
|
414
389
|
// `index.html`
|
|
@@ -420,14 +395,16 @@ function createWebpackConfig(workspaceDir, entryFiles, publicDir = 'public') {
|
|
|
420
395
|
manifest[file.name] = file.path;
|
|
421
396
|
return manifest;
|
|
422
397
|
}, seed);
|
|
423
|
-
const entrypointFiles = entrypoints.main.filter(fileName => !fileName.endsWith('.map'));
|
|
398
|
+
const entrypointFiles = entrypoints.main.filter(fileName => !fileName.endsWith('.map'));
|
|
424
399
|
|
|
400
|
+
// @ts-ignore - https://github.com/shellscape/webpack-manifest-plugin/issues/276
|
|
425
401
|
return {
|
|
426
402
|
files: manifestFiles,
|
|
427
403
|
entrypoints: entrypointFiles
|
|
428
404
|
};
|
|
429
405
|
}
|
|
430
|
-
}),
|
|
406
|
+
}),
|
|
407
|
+
// Moment.js is an extremely popular library that bundles large locale files
|
|
431
408
|
// by default due to how webpack interprets its code. This is a practical
|
|
432
409
|
// solution that requires the user to opt into importing specific locales.
|
|
433
410
|
// https://github.com/jmblog/how-to-optimize-momentjs-with-webpack
|
|
@@ -435,7 +412,8 @@ function createWebpackConfig(workspaceDir, entryFiles, publicDir = 'public') {
|
|
|
435
412
|
new (_webpack().default.IgnorePlugin)({
|
|
436
413
|
resourceRegExp: /^\.\/locale$/,
|
|
437
414
|
contextRegExp: /moment$/
|
|
438
|
-
}),
|
|
415
|
+
}),
|
|
416
|
+
// Generate a service worker script that will precache, and keep up to date,
|
|
439
417
|
// the HTML & assets that are part of the webpack build.
|
|
440
418
|
isEnvProduction && new (_workboxWebpackPlugin().default.GenerateSW)({
|
|
441
419
|
clientsClaim: true,
|
|
@@ -443,8 +421,10 @@ function createWebpackConfig(workspaceDir, entryFiles, publicDir = 'public') {
|
|
|
443
421
|
exclude: [/\.map$/, /asset-manifest\.json$/],
|
|
444
422
|
// importWorkboxFrom: 'cdn',
|
|
445
423
|
navigateFallback: 'public/index.html',
|
|
446
|
-
navigateFallbackDenylist: [
|
|
447
|
-
|
|
424
|
+
navigateFallbackDenylist: [
|
|
425
|
+
// Exclude URLs starting with /_, as they're likely an API call
|
|
426
|
+
new RegExp('^/_'),
|
|
427
|
+
// Exclude any URLs whose last part seems to be a file extension
|
|
448
428
|
// as they're likely a resource and not a SPA route.
|
|
449
429
|
// URLs containing a "?" character won't be blacklisted as they're likely
|
|
450
430
|
// a route with query params (e.g. auth callbacks).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["baseStyleLoadersOptions","injectingLoader","MiniCssExtractPlugin","loader","cssLoaderPath","require","resolve","postCssLoaderPath","postCssConfig","moduleFileExtensions","shouldUseSourceMap","process","env","GENERATE_SOURCEMAP","imageInlineSizeLimit","parseInt","IMAGE_INLINE_SIZE_LIMIT","isEnvProduction","createWebpackConfig","workspaceDir","entryFiles","publicDir","isEnvProductionProfile","argv","includes","stats","children","errorDetails","mode","entry","main","output","path","join","filename","chunkFilename","extensions","map","ext","alias","react","fallback","module","fallbacks","dgram","dns","fs","stream","http2","net","tls","child_process","strictExportPresence","rules","test","fullySpecified","oneOf","stylesRegexps","cssNoModulesRegex","use","generateStyleLoaders","merge","cssLoaderOpts","importLoaders","sourceMap","sideEffects","type","parser","dataUrlCondition","maxSize","options","babelrc","configFile","customize","cacheDirectory","cacheCompression","compact","cssModuleRegex","modules","getLocalIdent","getCSSModuleLocalIdent","sassNoModuleRegex","preProcessOptions","resolveUrlLoaderPath","preProcessorPath","sassModuleRegex","lessNoModuleRegex","lessModuleRegex","exclude","plugins","WebpackManifestPlugin","fileName","generate","seed","files","entrypoints","manifestFiles","reduce","manifest","file","name","entrypointFiles","filter","endsWith","webpack","IgnorePlugin","resourceRegExp","contextRegExp","WorkboxWebpackPlugin","GenerateSW","clientsClaim","maximumFileSizeToCacheInBytes","navigateFallback","navigateFallbackDenylist","RegExp","Boolean","performance"],"sources":["webpack.base.config.ts"],"sourcesContent":["import { merge } from 'lodash';\nimport webpack, { Configuration } from 'webpack';\nimport MiniCssExtractPlugin from 'mini-css-extract-plugin';\nimport { WebpackManifestPlugin } from 'webpack-manifest-plugin';\nimport WorkboxWebpackPlugin from 'workbox-webpack-plugin';\nimport getCSSModuleLocalIdent from 'react-dev-utils/getCSSModuleLocalIdent';\nimport path from 'path';\nimport * as stylesRegexps from '@teambit/webpack.modules.style-regexps';\nimport { generateStyleLoaders } from '@teambit/webpack.modules.generate-style-loaders';\nimport { fallbacks } from '@teambit/webpack';\nimport { postCssConfig } from './postcss.config';\n\nconst baseStyleLoadersOptions = {\n injectingLoader: MiniCssExtractPlugin.loader,\n cssLoaderPath: require.resolve('css-loader'),\n postCssLoaderPath: require.resolve('postcss-loader'),\n postCssConfig,\n};\n\nconst moduleFileExtensions = [\n 'web.mjs',\n 'mjs',\n 'web.js',\n 'js',\n 'web.ts',\n 'ts',\n 'web.tsx',\n 'tsx',\n 'json',\n 'web.jsx',\n 'jsx',\n];\n\n// Source maps are resource heavy and can cause out of memory issue for large source files.\nconst shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false';\n\nconst imageInlineSizeLimit = parseInt(process.env.IMAGE_INLINE_SIZE_LIMIT || '10000');\n\nconst isEnvProduction = true;\n\n// This is the production and development configuration.\n// It is focused on developer experience, fast rebuilds, and a minimal bundle.\n// eslint-disable-next-line complexity\nexport default function createWebpackConfig(\n workspaceDir: string,\n entryFiles: string[],\n publicDir = 'public'\n): Configuration {\n // Variable used for enabling profiling in Production\n // passed into alias object. Uses a flag if passed into the build command\n const isEnvProductionProfile = process.argv.includes('--profile');\n\n // We will provide `paths.publicUrlOrPath` to our app\n // as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.\n // Omit trailing slash as %PUBLIC_URL%/xyz looks better than %PUBLIC_URL%xyz.\n // Get environment variables to inject into our app.\n // const env = getClientEnvironment(publicUrlOrPath.slice(0, -1));\n\n return {\n stats: {\n children: true,\n errorDetails: true,\n },\n mode: 'production',\n entry: {\n main: entryFiles,\n },\n\n output: {\n // The build folder.\n path: path.join(workspaceDir, publicDir), // default value\n\n filename: 'static/js/[name].[contenthash:8].js',\n // TODO: remove this when upgrading to webpack 5\n // futureEmitAssets: true,\n // There are also additional JS chunk files if you use code splitting.\n chunkFilename: 'static/js/[name].[contenthash:8].chunk.js',\n // this defaults to 'window', but by setting it to 'this' then\n // module chunks which are built will work in web workers as well.\n // Commented out to use the default (self) as according to tobias with webpack5 self is working with workers as well\n // globalObject: 'this',\n },\n\n resolve: {\n // These are the reasonable defaults supported by the Node ecosystem.\n // We also include JSX as a common component filename extension to support\n // some tools, although we do not recommend using it, see:\n // https://github.com/facebook/create-react-app/issues/290\n // `web` extension prefixes have been added for better support\n // for React Native Web.\n extensions: moduleFileExtensions.map((ext) => `.${ext}`),\n\n alias: {\n // TODO: @uri please remember to remove after publishing evangelist and base-ui\n react: require.resolve('react'),\n 'react-dom/server': require.resolve('react-dom/server'),\n 'react-dom': require.resolve('react-dom'),\n // Allows for better profiling with ReactDevTools\n ...(isEnvProductionProfile && {\n 'react-dom$': 'react-dom/profiling',\n 'scheduler/tracing': 'scheduler/tracing-profiling',\n }),\n },\n fallback: {\n module: false,\n path: fallbacks.path,\n dgram: false,\n dns: false,\n fs: false,\n stream: false,\n http2: false,\n net: false,\n tls: false,\n child_process: false,\n process: fallbacks.process,\n },\n },\n module: {\n strictExportPresence: true,\n rules: [\n {\n test: /\\.m?js/,\n resolve: {\n fullySpecified: false,\n },\n },\n // Disable require.ensure as it's not a standard language feature.\n // { parser: { requireEnsure: false } },\n {\n // \"oneOf\" will traverse all following loaders until one will\n // match the requirements. When no loader matches it will fall\n // back to the \"file\" loader at the end of the loader list.\n oneOf: [\n // \"postcss\" loader applies autoprefixer to our CSS.\n // \"css\" loader resolves paths in CSS and adds assets as dependencies.\n // \"style\" loader turns CSS into JS modules that inject <style> tags.\n // In production, we use MiniCSSExtractPlugin to extract that CSS\n // to a file, but in development \"style\" loader enables hot editing\n // of CSS.\n // By default we support CSS Modules with the extension .module.css\n {\n test: stylesRegexps.cssNoModulesRegex,\n use: generateStyleLoaders(\n merge({}, baseStyleLoadersOptions, {\n cssLoaderOpts: {\n importLoaders: 1,\n sourceMap: isEnvProduction || shouldUseSourceMap,\n },\n })\n ),\n // Don't consider CSS imports dead code even if the\n // containing package claims to have no side effects.\n // Remove this when webpack adds a warning or an error for this.\n // See https://github.com/webpack/webpack/issues/6571\n sideEffects: true,\n },\n // \"url\" loader works like \"file\" loader except that it embeds assets\n // smaller than specified limit in bytes as data URLs to avoid requests.\n // A missing `test` is equivalent to a match.\n {\n test: [/\\.bmp$/, /\\.gif$/, /\\.jpe?g$/, /\\.png$/, /\\.svg$/],\n type: 'asset',\n parser: {\n dataUrlCondition: {\n maxSize: imageInlineSizeLimit,\n },\n },\n },\n // Process application JS with Babel.\n // The preset includes JSX, Flow, TypeScript, and some ESnext features.\n {\n test: /\\.(js|mjs|jsx|ts|tsx)$/,\n loader: require.resolve('babel-loader'),\n options: {\n babelrc: false,\n configFile: false,\n customize: require.resolve('babel-preset-react-app/webpack-overrides'),\n // This is a feature of `babel-loader` for webpack (not Babel itself).\n // It enables caching results in ./node_modules/.cache/babel-loader/\n // directory for faster rebuilds.\n cacheDirectory: true,\n // See #6846 for context on why cacheCompression is disabled\n cacheCompression: false,\n compact: isEnvProduction,\n },\n },\n // Process any JS outside of the app with Babel.\n // Unlike the application JS, we only compile the standard ES features.\n // Probably not needed in our use case\n // {\n // test: /\\.(js|mjs)$/,\n // exclude: /@babel(?:\\/|\\\\{1,2})runtime/,\n // loader: require.resolve('babel-loader'),\n // options: {\n // babelrc: false,\n // configFile: false,\n // compact: false,\n // presets: [[require.resolve('babel-preset-react-app/dependencies'), { helpers: true }]],\n // cacheDirectory: true,\n // // See #6846 for context on why cacheCompression is disabled\n // cacheCompression: false,\n\n // // Babel sourcemaps are needed for debugging into node_modules\n // // code. Without the options below, debuggers like VSCode\n // // show incorrect code and set breakpoints on the wrong lines.\n // sourceMaps: shouldUseSourceMap,\n // inputSourceMap: shouldUseSourceMap,\n // },\n // },\n\n // Adds support for CSS Modules (https://github.com/css-modules/css-modules)\n // using the extension .module.css\n {\n test: stylesRegexps.cssModuleRegex,\n use: generateStyleLoaders(\n merge({}, baseStyleLoadersOptions, {\n cssLoaderOpts: {\n importLoaders: 1,\n sourceMap: isEnvProduction || shouldUseSourceMap,\n modules: {\n getLocalIdent: getCSSModuleLocalIdent,\n },\n },\n shouldUseSourceMap: isEnvProduction || shouldUseSourceMap,\n })\n ),\n },\n // Opt-in support for SASS (using .scss or .sass extensions).\n // By default we support SASS Modules with the\n // extensions .module.scss or .module.sass\n {\n test: stylesRegexps.sassNoModuleRegex,\n use: generateStyleLoaders(\n merge({}, baseStyleLoadersOptions, {\n cssLoaderOpts: {\n importLoaders: 3,\n sourceMap: isEnvProduction || shouldUseSourceMap,\n },\n shouldUseSourceMap: isEnvProduction || shouldUseSourceMap,\n preProcessOptions: {\n resolveUrlLoaderPath: require.resolve('resolve-url-loader'),\n preProcessorPath: require.resolve('sass-loader'),\n },\n })\n ),\n // Don't consider CSS imports dead code even if the\n // containing package claims to have no side effects.\n // Remove this when webpack adds a warning or an error for this.\n // See https://github.com/webpack/webpack/issues/6571\n sideEffects: true,\n },\n // Adds support for CSS Modules, but using SASS\n // using the extension .module.scss or .module.sass\n {\n test: stylesRegexps.sassModuleRegex,\n use: generateStyleLoaders(\n merge({}, baseStyleLoadersOptions, {\n cssLoaderOpts: {\n importLoaders: 3,\n sourceMap: isEnvProduction || shouldUseSourceMap,\n modules: {\n getLocalIdent: getCSSModuleLocalIdent,\n },\n },\n shouldUseSourceMap: isEnvProduction || shouldUseSourceMap,\n preProcessOptions: {\n resolveUrlLoaderPath: require.resolve('resolve-url-loader'),\n preProcessorPath: require.resolve('sass-loader'),\n },\n })\n ),\n },\n {\n test: stylesRegexps.lessNoModuleRegex,\n use: generateStyleLoaders(\n merge({}, baseStyleLoadersOptions, {\n cssLoaderOpts: {\n importLoaders: 1,\n sourceMap: isEnvProduction || shouldUseSourceMap,\n },\n shouldUseSourceMap: isEnvProduction || shouldUseSourceMap,\n preProcessOptions: {\n resolveUrlLoaderPath: require.resolve('resolve-url-loader'),\n preProcessorPath: require.resolve('less-loader'),\n },\n })\n ),\n // Don't consider CSS imports dead code even if the\n // containing package claims to have no side effects.\n // Remove this when webpack adds a warning or an error for this.\n // See https://github.com/webpack/webpack/issues/6571\n sideEffects: true,\n },\n {\n test: stylesRegexps.lessModuleRegex,\n use: generateStyleLoaders(\n merge({}, baseStyleLoadersOptions, {\n cssLoaderOpts: {\n importLoaders: 1,\n sourceMap: isEnvProduction || shouldUseSourceMap,\n modules: {\n getLocalIdent: getCSSModuleLocalIdent,\n },\n },\n shouldUseSourceMap: isEnvProduction || shouldUseSourceMap,\n preProcessOptions: {\n resolveUrlLoaderPath: require.resolve('resolve-url-loader'),\n preProcessorPath: require.resolve('less-loader'),\n },\n })\n ),\n },\n // \"file\" loader makes sure those assets get served by WebpackDevServer.\n // When you `import` an asset, you get its (virtual) filename.\n // In production, they would get copied to the `build` folder.\n // This loader doesn't use a \"test\" so it will catch all modules\n // that fall through the other loaders.\n {\n // Exclude `js` files to keep \"css\" loader working as it injects\n // its runtime that would otherwise be processed through \"file\" loader.\n // Also exclude `html` and `json` extensions so they get processed\n // by webpacks internal loaders.\n exclude: [/\\.(js|mjs|jsx|ts|tsx)$/, /\\.html$/, /\\.json$/, /\\.css$/],\n type: 'asset/resource',\n },\n // ** STOP ** Are you adding a new loader?\n // Make sure to add the new loader(s) before the \"file\" loader.\n ],\n },\n ],\n },\n plugins: [\n new MiniCssExtractPlugin({\n // Options similar to the same options in webpackOptions.output\n // both options are optional\n filename: 'static/css/[name].[contenthash:8].css',\n chunkFilename: 'static/css/[name].[contenthash:8].chunk.css',\n }),\n // Generate an asset manifest file with the following content:\n // - \"files\" key: Mapping of all asset filenames to their corresponding\n // output file so that tools can pick it up without having to parse\n // `index.html`\n // can be used to reconstruct the HTML if necessary\n new WebpackManifestPlugin({\n fileName: 'asset-manifest.json',\n generate: (seed, files, entrypoints) => {\n const manifestFiles = files.reduce((manifest, file) => {\n manifest[file.name] = file.path;\n return manifest;\n }, seed);\n const entrypointFiles = entrypoints.main.filter((fileName) => !fileName.endsWith('.map'));\n\n // @ts-ignore - https://github.com/shellscape/webpack-manifest-plugin/issues/276\n return {\n files: manifestFiles,\n entrypoints: entrypointFiles,\n } as Record<string, string>;\n },\n }),\n // Moment.js is an extremely popular library that bundles large locale files\n // by default due to how webpack interprets its code. This is a practical\n // solution that requires the user to opt into importing specific locales.\n // https://github.com/jmblog/how-to-optimize-momentjs-with-webpack\n // You can remove this if you don't use Moment.js:\n new webpack.IgnorePlugin({\n resourceRegExp: /^\\.\\/locale$/,\n contextRegExp: /moment$/,\n }),\n // Generate a service worker script that will precache, and keep up to date,\n // the HTML & assets that are part of the webpack build.\n isEnvProduction &&\n new WorkboxWebpackPlugin.GenerateSW({\n clientsClaim: true,\n maximumFileSizeToCacheInBytes: 5000000,\n exclude: [/\\.map$/, /asset-manifest\\.json$/],\n // importWorkboxFrom: 'cdn',\n navigateFallback: 'public/index.html',\n navigateFallbackDenylist: [\n // Exclude URLs starting with /_, as they're likely an API call\n new RegExp('^/_'),\n // Exclude any URLs whose last part seems to be a file extension\n // as they're likely a resource and not a SPA route.\n // URLs containing a \"?\" character won't be blacklisted as they're likely\n // a route with query params (e.g. auth callbacks).\n new RegExp('/[^/?]+\\\\.[^/]+$'),\n ],\n }),\n ].filter(Boolean),\n // Some libraries import Node modules but don't use them in the browser.\n // Tell webpack to provide empty mocks for them so importing them works.\n // Turn off performance processing because we utilize\n // our own hints via the FileSizeReporter\n performance: false,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;E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,CAACC,IAAN,CAAR,GAAsBD,IAAI,CAACnE,IAA3B;UACA,OAAOkE,QAAP;QACD,CAHqB,EAGnBL,IAHmB,CAAtB;QAIA,MAAMQ,eAAe,GAAGN,WAAW,CAACjE,IAAZ,CAAiBwE,MAAjB,CAAyBX,QAAD,IAAc,CAACA,QAAQ,CAACY,QAAT,CAAkB,MAAlB,CAAvC,CAAxB,CALsC,CAOtC;;QACA,OAAO;UACLT,KAAK,EAAEE,aADF;UAELD,WAAW,EAAEM;QAFR,CAAP;MAID;IAduB,CAA1B,CAZO,EA4BP;IACA;IACA;IACA;IACA;IACA,KAAIG,kBAAA,CAAQC,YAAZ,EAAyB;MACvBC,cAAc,EAAE,cADO;MAEvBC,aAAa,EAAE;IAFQ,CAAzB,CAjCO,EAqCP;IACA;IACA1F,eAAe,IACb,KAAI2F,+BAAA,CAAqBC,UAAzB,EAAoC;MAClCC,YAAY,EAAE,IADoB;MAElCC,6BAA6B,EAAE,OAFG;MAGlCvB,OAAO,EAAE,CAAC,QAAD,EAAW,uBAAX,CAHyB;MAIlC;MACAwB,gBAAgB,EAAE,mBALgB;MAMlCC,wBAAwB,EAAE,CACxB;MACA,IAAIC,MAAJ,CAAW,KAAX,CAFwB,EAGxB;MACA;MACA;MACA;MACA,IAAIA,MAAJ,CAAW,kBAAX,CAPwB;IANQ,CAApC,CAxCK,EAwDPZ,MAxDO,CAwDAa,OAxDA,CAjRJ;IA0UL;IACA;IACA;IACA;IACAC,WAAW,EAAE;EA9UR,CAAP;AAgVD"}
|
|
1
|
+
{"version":3,"names":["baseStyleLoadersOptions","injectingLoader","MiniCssExtractPlugin","loader","cssLoaderPath","require","resolve","postCssLoaderPath","postCssConfig","moduleFileExtensions","shouldUseSourceMap","process","env","GENERATE_SOURCEMAP","imageInlineSizeLimit","parseInt","IMAGE_INLINE_SIZE_LIMIT","isEnvProduction","createWebpackConfig","workspaceDir","entryFiles","publicDir","isEnvProductionProfile","argv","includes","stats","children","errorDetails","mode","entry","main","output","path","join","filename","chunkFilename","extensions","map","ext","alias","react","fallback","module","fallbacks","dgram","dns","fs","stream","http2","net","tls","child_process","strictExportPresence","rules","test","fullySpecified","oneOf","stylesRegexps","cssNoModulesRegex","use","generateStyleLoaders","merge","cssLoaderOpts","importLoaders","sourceMap","sideEffects","type","parser","dataUrlCondition","maxSize","options","babelrc","configFile","customize","cacheDirectory","cacheCompression","compact","cssModuleRegex","modules","getLocalIdent","getCSSModuleLocalIdent","sassNoModuleRegex","preProcessOptions","resolveUrlLoaderPath","preProcessorPath","sassModuleRegex","lessNoModuleRegex","lessModuleRegex","exclude","plugins","WebpackManifestPlugin","fileName","generate","seed","files","entrypoints","manifestFiles","reduce","manifest","file","name","entrypointFiles","filter","endsWith","webpack","IgnorePlugin","resourceRegExp","contextRegExp","WorkboxWebpackPlugin","GenerateSW","clientsClaim","maximumFileSizeToCacheInBytes","navigateFallback","navigateFallbackDenylist","RegExp","Boolean","performance"],"sources":["webpack.base.config.ts"],"sourcesContent":["import { merge } from 'lodash';\nimport webpack, { Configuration } from 'webpack';\nimport MiniCssExtractPlugin from 'mini-css-extract-plugin';\nimport { WebpackManifestPlugin } from 'webpack-manifest-plugin';\nimport WorkboxWebpackPlugin from 'workbox-webpack-plugin';\nimport getCSSModuleLocalIdent from 'react-dev-utils/getCSSModuleLocalIdent';\nimport path from 'path';\nimport * as stylesRegexps from '@teambit/webpack.modules.style-regexps';\nimport { generateStyleLoaders } from '@teambit/webpack.modules.generate-style-loaders';\nimport { fallbacks } from '@teambit/webpack';\nimport { postCssConfig } from './postcss.config';\n\nconst baseStyleLoadersOptions = {\n injectingLoader: MiniCssExtractPlugin.loader,\n cssLoaderPath: require.resolve('css-loader'),\n postCssLoaderPath: require.resolve('postcss-loader'),\n postCssConfig,\n};\n\nconst moduleFileExtensions = [\n 'web.mjs',\n 'mjs',\n 'web.js',\n 'js',\n 'web.ts',\n 'ts',\n 'web.tsx',\n 'tsx',\n 'json',\n 'web.jsx',\n 'jsx',\n];\n\n// Source maps are resource heavy and can cause out of memory issue for large source files.\nconst shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false';\n\nconst imageInlineSizeLimit = parseInt(process.env.IMAGE_INLINE_SIZE_LIMIT || '10000');\n\nconst isEnvProduction = true;\n\n// This is the production and development configuration.\n// It is focused on developer experience, fast rebuilds, and a minimal bundle.\n// eslint-disable-next-line complexity\nexport default function createWebpackConfig(\n workspaceDir: string,\n entryFiles: string[],\n publicDir = 'public'\n): Configuration {\n // Variable used for enabling profiling in Production\n // passed into alias object. Uses a flag if passed into the build command\n const isEnvProductionProfile = process.argv.includes('--profile');\n\n // We will provide `paths.publicUrlOrPath` to our app\n // as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.\n // Omit trailing slash as %PUBLIC_URL%/xyz looks better than %PUBLIC_URL%xyz.\n // Get environment variables to inject into our app.\n // const env = getClientEnvironment(publicUrlOrPath.slice(0, -1));\n\n return {\n stats: {\n children: true,\n errorDetails: true,\n },\n mode: 'production',\n entry: {\n main: entryFiles,\n },\n\n output: {\n // The build folder.\n path: path.join(workspaceDir, publicDir), // default value\n\n filename: 'static/js/[name].[contenthash:8].js',\n // TODO: remove this when upgrading to webpack 5\n // futureEmitAssets: true,\n // There are also additional JS chunk files if you use code splitting.\n chunkFilename: 'static/js/[name].[contenthash:8].chunk.js',\n // this defaults to 'window', but by setting it to 'this' then\n // module chunks which are built will work in web workers as well.\n // Commented out to use the default (self) as according to tobias with webpack5 self is working with workers as well\n // globalObject: 'this',\n },\n\n resolve: {\n // These are the reasonable defaults supported by the Node ecosystem.\n // We also include JSX as a common component filename extension to support\n // some tools, although we do not recommend using it, see:\n // https://github.com/facebook/create-react-app/issues/290\n // `web` extension prefixes have been added for better support\n // for React Native Web.\n extensions: moduleFileExtensions.map((ext) => `.${ext}`),\n\n alias: {\n // TODO: @uri please remember to remove after publishing evangelist and base-ui\n react: require.resolve('react'),\n 'react-dom/server': require.resolve('react-dom/server'),\n 'react-dom': require.resolve('react-dom'),\n // Allows for better profiling with ReactDevTools\n ...(isEnvProductionProfile && {\n 'react-dom$': 'react-dom/profiling',\n 'scheduler/tracing': 'scheduler/tracing-profiling',\n }),\n },\n fallback: {\n module: false,\n path: fallbacks.path,\n dgram: false,\n dns: false,\n fs: false,\n stream: false,\n http2: false,\n net: false,\n tls: false,\n child_process: false,\n process: fallbacks.process,\n },\n },\n module: {\n strictExportPresence: true,\n rules: [\n {\n test: /\\.m?js/,\n resolve: {\n fullySpecified: false,\n },\n },\n // Disable require.ensure as it's not a standard language feature.\n // { parser: { requireEnsure: false } },\n {\n // \"oneOf\" will traverse all following loaders until one will\n // match the requirements. When no loader matches it will fall\n // back to the \"file\" loader at the end of the loader list.\n oneOf: [\n // \"postcss\" loader applies autoprefixer to our CSS.\n // \"css\" loader resolves paths in CSS and adds assets as dependencies.\n // \"style\" loader turns CSS into JS modules that inject <style> tags.\n // In production, we use MiniCSSExtractPlugin to extract that CSS\n // to a file, but in development \"style\" loader enables hot editing\n // of CSS.\n // By default we support CSS Modules with the extension .module.css\n {\n test: stylesRegexps.cssNoModulesRegex,\n use: generateStyleLoaders(\n merge({}, baseStyleLoadersOptions, {\n cssLoaderOpts: {\n importLoaders: 1,\n sourceMap: isEnvProduction || shouldUseSourceMap,\n },\n })\n ),\n // Don't consider CSS imports dead code even if the\n // containing package claims to have no side effects.\n // Remove this when webpack adds a warning or an error for this.\n // See https://github.com/webpack/webpack/issues/6571\n sideEffects: true,\n },\n // \"url\" loader works like \"file\" loader except that it embeds assets\n // smaller than specified limit in bytes as data URLs to avoid requests.\n // A missing `test` is equivalent to a match.\n {\n test: [/\\.bmp$/, /\\.gif$/, /\\.jpe?g$/, /\\.png$/, /\\.svg$/],\n type: 'asset',\n parser: {\n dataUrlCondition: {\n maxSize: imageInlineSizeLimit,\n },\n },\n },\n // Process application JS with Babel.\n // The preset includes JSX, Flow, TypeScript, and some ESnext features.\n {\n test: /\\.(js|mjs|jsx|ts|tsx)$/,\n loader: require.resolve('babel-loader'),\n options: {\n babelrc: false,\n configFile: false,\n customize: require.resolve('babel-preset-react-app/webpack-overrides'),\n // This is a feature of `babel-loader` for webpack (not Babel itself).\n // It enables caching results in ./node_modules/.cache/babel-loader/\n // directory for faster rebuilds.\n cacheDirectory: true,\n // See #6846 for context on why cacheCompression is disabled\n cacheCompression: false,\n compact: isEnvProduction,\n },\n },\n // Process any JS outside of the app with Babel.\n // Unlike the application JS, we only compile the standard ES features.\n // Probably not needed in our use case\n // {\n // test: /\\.(js|mjs)$/,\n // exclude: /@babel(?:\\/|\\\\{1,2})runtime/,\n // loader: require.resolve('babel-loader'),\n // options: {\n // babelrc: false,\n // configFile: false,\n // compact: false,\n // presets: [[require.resolve('babel-preset-react-app/dependencies'), { helpers: true }]],\n // cacheDirectory: true,\n // // See #6846 for context on why cacheCompression is disabled\n // cacheCompression: false,\n\n // // Babel sourcemaps are needed for debugging into node_modules\n // // code. Without the options below, debuggers like VSCode\n // // show incorrect code and set breakpoints on the wrong lines.\n // sourceMaps: shouldUseSourceMap,\n // inputSourceMap: shouldUseSourceMap,\n // },\n // },\n\n // Adds support for CSS Modules (https://github.com/css-modules/css-modules)\n // using the extension .module.css\n {\n test: stylesRegexps.cssModuleRegex,\n use: generateStyleLoaders(\n merge({}, baseStyleLoadersOptions, {\n cssLoaderOpts: {\n importLoaders: 1,\n sourceMap: isEnvProduction || shouldUseSourceMap,\n modules: {\n getLocalIdent: getCSSModuleLocalIdent,\n },\n },\n shouldUseSourceMap: isEnvProduction || shouldUseSourceMap,\n })\n ),\n },\n // Opt-in support for SASS (using .scss or .sass extensions).\n // By default we support SASS Modules with the\n // extensions .module.scss or .module.sass\n {\n test: stylesRegexps.sassNoModuleRegex,\n use: generateStyleLoaders(\n merge({}, baseStyleLoadersOptions, {\n cssLoaderOpts: {\n importLoaders: 3,\n sourceMap: isEnvProduction || shouldUseSourceMap,\n },\n shouldUseSourceMap: isEnvProduction || shouldUseSourceMap,\n preProcessOptions: {\n resolveUrlLoaderPath: require.resolve('resolve-url-loader'),\n preProcessorPath: require.resolve('sass-loader'),\n },\n })\n ),\n // Don't consider CSS imports dead code even if the\n // containing package claims to have no side effects.\n // Remove this when webpack adds a warning or an error for this.\n // See https://github.com/webpack/webpack/issues/6571\n sideEffects: true,\n },\n // Adds support for CSS Modules, but using SASS\n // using the extension .module.scss or .module.sass\n {\n test: stylesRegexps.sassModuleRegex,\n use: generateStyleLoaders(\n merge({}, baseStyleLoadersOptions, {\n cssLoaderOpts: {\n importLoaders: 3,\n sourceMap: isEnvProduction || shouldUseSourceMap,\n modules: {\n getLocalIdent: getCSSModuleLocalIdent,\n },\n },\n shouldUseSourceMap: isEnvProduction || shouldUseSourceMap,\n preProcessOptions: {\n resolveUrlLoaderPath: require.resolve('resolve-url-loader'),\n preProcessorPath: require.resolve('sass-loader'),\n },\n })\n ),\n },\n {\n test: stylesRegexps.lessNoModuleRegex,\n use: generateStyleLoaders(\n merge({}, baseStyleLoadersOptions, {\n cssLoaderOpts: {\n importLoaders: 1,\n sourceMap: isEnvProduction || shouldUseSourceMap,\n },\n shouldUseSourceMap: isEnvProduction || shouldUseSourceMap,\n preProcessOptions: {\n resolveUrlLoaderPath: require.resolve('resolve-url-loader'),\n preProcessorPath: require.resolve('less-loader'),\n },\n })\n ),\n // Don't consider CSS imports dead code even if the\n // containing package claims to have no side effects.\n // Remove this when webpack adds a warning or an error for this.\n // See https://github.com/webpack/webpack/issues/6571\n sideEffects: true,\n },\n {\n test: stylesRegexps.lessModuleRegex,\n use: generateStyleLoaders(\n merge({}, baseStyleLoadersOptions, {\n cssLoaderOpts: {\n importLoaders: 1,\n sourceMap: isEnvProduction || shouldUseSourceMap,\n modules: {\n getLocalIdent: getCSSModuleLocalIdent,\n },\n },\n shouldUseSourceMap: isEnvProduction || shouldUseSourceMap,\n preProcessOptions: {\n resolveUrlLoaderPath: require.resolve('resolve-url-loader'),\n preProcessorPath: require.resolve('less-loader'),\n },\n })\n ),\n },\n // \"file\" loader makes sure those assets get served by WebpackDevServer.\n // When you `import` an asset, you get its (virtual) filename.\n // In production, they would get copied to the `build` folder.\n // This loader doesn't use a \"test\" so it will catch all modules\n // that fall through the other loaders.\n {\n // Exclude `js` files to keep \"css\" loader working as it injects\n // its runtime that would otherwise be processed through \"file\" loader.\n // Also exclude `html` and `json` extensions so they get processed\n // by webpacks internal loaders.\n exclude: [/\\.(js|mjs|jsx|ts|tsx)$/, /\\.html$/, /\\.json$/, /\\.css$/],\n type: 'asset/resource',\n },\n // ** STOP ** Are you adding a new loader?\n // Make sure to add the new loader(s) before the \"file\" loader.\n ],\n },\n ],\n },\n plugins: [\n new MiniCssExtractPlugin({\n // Options similar to the same options in webpackOptions.output\n // both options are optional\n filename: 'static/css/[name].[contenthash:8].css',\n chunkFilename: 'static/css/[name].[contenthash:8].chunk.css',\n }),\n // Generate an asset manifest file with the following content:\n // - \"files\" key: Mapping of all asset filenames to their corresponding\n // output file so that tools can pick it up without having to parse\n // `index.html`\n // can be used to reconstruct the HTML if necessary\n new WebpackManifestPlugin({\n fileName: 'asset-manifest.json',\n generate: (seed, files, entrypoints) => {\n const manifestFiles = files.reduce((manifest, file) => {\n manifest[file.name] = file.path;\n return manifest;\n }, seed);\n const entrypointFiles = entrypoints.main.filter((fileName) => !fileName.endsWith('.map'));\n\n // @ts-ignore - https://github.com/shellscape/webpack-manifest-plugin/issues/276\n return {\n files: manifestFiles,\n entrypoints: entrypointFiles,\n } as Record<string, string>;\n },\n }),\n // Moment.js is an extremely popular library that bundles large locale files\n // by default due to how webpack interprets its code. This is a practical\n // solution that requires the user to opt into importing specific locales.\n // https://github.com/jmblog/how-to-optimize-momentjs-with-webpack\n // You can remove this if you don't use Moment.js:\n new webpack.IgnorePlugin({\n resourceRegExp: /^\\.\\/locale$/,\n contextRegExp: /moment$/,\n }),\n // Generate a service worker script that will precache, and keep up to date,\n // the HTML & assets that are part of the webpack build.\n isEnvProduction &&\n new WorkboxWebpackPlugin.GenerateSW({\n clientsClaim: true,\n maximumFileSizeToCacheInBytes: 5000000,\n exclude: [/\\.map$/, /asset-manifest\\.json$/],\n // importWorkboxFrom: 'cdn',\n navigateFallback: 'public/index.html',\n navigateFallbackDenylist: [\n // Exclude URLs starting with /_, as they're likely an API call\n new RegExp('^/_'),\n // Exclude any URLs whose last part seems to be a file extension\n // as they're likely a resource and not a SPA route.\n // URLs containing a \"?\" character won't be blacklisted as they're likely\n // a route with query params (e.g. auth callbacks).\n new RegExp('/[^/?]+\\\\.[^/]+$'),\n ],\n }),\n ].filter(Boolean),\n // Some libraries import Node modules but don't use them in the browser.\n // Tell webpack to provide empty mocks for them so importing them works.\n // Turn off performance processing because we utilize\n // our own hints via the FileSizeReporter\n performance: false,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAiD;AAAA;AAAA;AAAA;AAEjD,MAAMA,uBAAuB,GAAG;EAC9BC,eAAe,EAAEC,+BAAoB,CAACC,MAAM;EAC5CC,aAAa,EAAEC,OAAO,CAACC,OAAO,CAAC,YAAY,CAAC;EAC5CC,iBAAiB,EAAEF,OAAO,CAACC,OAAO,CAAC,gBAAgB,CAAC;EACpDE,aAAa,EAAbA;AACF,CAAC;AAED,MAAMC,oBAAoB,GAAG,CAC3B,SAAS,EACT,KAAK,EACL,QA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,EAAC;MACvBC,cAAc,EAAE,cAAc;MAC9BC,aAAa,EAAE;IACjB,CAAC,CAAC;IACF;IACA;IACA1F,eAAe,IACb,KAAI2F,+BAAoB,CAACC,UAAU,EAAC;MAClCC,YAAY,EAAE,IAAI;MAClBC,6BAA6B,EAAE,OAAO;MACtCvB,OAAO,EAAE,CAAC,QAAQ,EAAE,uBAAuB,CAAC;MAC5C;MACAwB,gBAAgB,EAAE,mBAAmB;MACrCC,wBAAwB,EAAE;MACxB;MACA,IAAIC,MAAM,CAAC,KAAK,CAAC;MACjB;MACA;MACA;MACA;MACA,IAAIA,MAAM,CAAC,kBAAkB,CAAC;IAElC,CAAC,CAAC,CACL,CAACZ,MAAM,CAACa,OAAO,CAAC;IACjB;IACA;IACA;IACA;IACAC,WAAW,EAAE;EACf,CAAC;AACH"}
|
|
@@ -1,112 +1,83 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = createWebpackConfig;
|
|
9
|
-
|
|
10
8
|
function _webpack() {
|
|
11
9
|
const data = require("webpack");
|
|
12
|
-
|
|
13
10
|
_webpack = function () {
|
|
14
11
|
return data;
|
|
15
12
|
};
|
|
16
|
-
|
|
17
13
|
return data;
|
|
18
14
|
}
|
|
19
|
-
|
|
20
15
|
function _terserWebpackPlugin() {
|
|
21
16
|
const data = _interopRequireDefault(require("terser-webpack-plugin"));
|
|
22
|
-
|
|
23
17
|
_terserWebpackPlugin = function () {
|
|
24
18
|
return data;
|
|
25
19
|
};
|
|
26
|
-
|
|
27
20
|
return data;
|
|
28
21
|
}
|
|
29
|
-
|
|
30
22
|
function _cssMinimizerWebpackPlugin() {
|
|
31
23
|
const data = _interopRequireDefault(require("css-minimizer-webpack-plugin"));
|
|
32
|
-
|
|
33
24
|
_cssMinimizerWebpackPlugin = function () {
|
|
34
25
|
return data;
|
|
35
26
|
};
|
|
36
|
-
|
|
37
27
|
return data;
|
|
38
28
|
}
|
|
39
|
-
|
|
40
29
|
function _path() {
|
|
41
30
|
const data = _interopRequireDefault(require("path"));
|
|
42
|
-
|
|
43
31
|
_path = function () {
|
|
44
32
|
return data;
|
|
45
33
|
};
|
|
46
|
-
|
|
47
34
|
return data;
|
|
48
35
|
}
|
|
49
|
-
|
|
50
36
|
function _htmlWebpackPlugin() {
|
|
51
37
|
const data = _interopRequireDefault(require("html-webpack-plugin"));
|
|
52
|
-
|
|
53
38
|
_htmlWebpackPlugin = function () {
|
|
54
39
|
return data;
|
|
55
40
|
};
|
|
56
|
-
|
|
57
41
|
return data;
|
|
58
42
|
}
|
|
59
|
-
|
|
60
43
|
function _webpackMerge() {
|
|
61
44
|
const data = require("webpack-merge");
|
|
62
|
-
|
|
63
45
|
_webpackMerge = function () {
|
|
64
46
|
return data;
|
|
65
47
|
};
|
|
66
|
-
|
|
67
48
|
return data;
|
|
68
49
|
}
|
|
69
|
-
|
|
70
50
|
function _webpack2() {
|
|
71
51
|
const data = require("@teambit/webpack");
|
|
72
|
-
|
|
73
52
|
_webpack2 = function () {
|
|
74
53
|
return data;
|
|
75
54
|
};
|
|
76
|
-
|
|
77
55
|
return data;
|
|
78
56
|
}
|
|
79
|
-
|
|
80
57
|
function _html() {
|
|
81
58
|
const data = require("./html");
|
|
82
|
-
|
|
83
59
|
_html = function () {
|
|
84
60
|
return data;
|
|
85
61
|
};
|
|
86
|
-
|
|
87
62
|
return data;
|
|
88
63
|
}
|
|
89
|
-
|
|
90
64
|
function _webpackBase() {
|
|
91
65
|
const data = _interopRequireDefault(require("./webpack.base.config"));
|
|
92
|
-
|
|
93
66
|
_webpackBase = function () {
|
|
94
67
|
return data;
|
|
95
68
|
};
|
|
96
|
-
|
|
97
69
|
return data;
|
|
98
70
|
}
|
|
99
|
-
|
|
100
71
|
function createWebpackConfig(workspaceDir, entryFiles, title, publicDir) {
|
|
101
72
|
const baseConfig = (0, _webpackBase().default)(workspaceDir, entryFiles);
|
|
102
73
|
const browserConfig = createBrowserConfig(workspaceDir, title, publicDir);
|
|
103
74
|
const combined = (0, _webpackMerge().merge)(baseConfig, browserConfig);
|
|
104
75
|
return combined;
|
|
105
76
|
}
|
|
106
|
-
|
|
107
77
|
function createBrowserConfig(workspaceDir, title, publicDir) {
|
|
108
78
|
const browserConfig = {
|
|
109
79
|
// target: 'web', // already default
|
|
80
|
+
|
|
110
81
|
output: {
|
|
111
82
|
path: _path().default.resolve(workspaceDir, publicDir),
|
|
112
83
|
// webpack uses `publicPath` to determine where the app is being served from.
|
|
@@ -116,7 +87,8 @@ function createBrowserConfig(workspaceDir, title, publicDir) {
|
|
|
116
87
|
},
|
|
117
88
|
optimization: {
|
|
118
89
|
minimize: true,
|
|
119
|
-
minimizer: [
|
|
90
|
+
minimizer: [
|
|
91
|
+
// This is only used in production mode
|
|
120
92
|
new (_terserWebpackPlugin().default)({
|
|
121
93
|
terserOptions: {
|
|
122
94
|
parse: {
|