@angular-devkit/build-angular 15.0.0-next.1 → 15.0.0-next.3
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/package.json +15 -17
- package/src/babel/presets/application.d.ts +1 -2
- package/src/babel/presets/application.js +1 -4
- package/src/babel/webpack-loader.js +8 -22
- package/src/builders/app-shell/index.js +16 -8
- package/src/builders/browser/index.d.ts +1 -1
- package/src/builders/browser/index.js +4 -16
- package/src/builders/browser/schema.d.ts +6 -2
- package/src/builders/browser/schema.json +18 -4
- package/src/builders/browser-esbuild/compiler-plugin.d.ts +1 -0
- package/src/builders/browser-esbuild/compiler-plugin.js +20 -17
- package/src/builders/browser-esbuild/experimental-warnings.js +0 -1
- package/src/builders/browser-esbuild/index.js +18 -5
- package/src/builders/browser-esbuild/options.js +6 -1
- package/src/builders/browser-esbuild/schema.d.ts +8 -6
- package/src/builders/browser-esbuild/schema.json +29 -34
- package/src/builders/browser-esbuild/stylesheets.d.ts +1 -0
- package/src/builders/browser-esbuild/stylesheets.js +1 -0
- package/src/builders/extract-i18n/index.js +1 -1
- package/src/builders/karma/find-tests-plugin.d.ts +19 -0
- package/src/builders/karma/{find-tests.js → find-tests-plugin.js} +49 -5
- package/src/builders/karma/index.js +40 -38
- package/src/builders/karma/schema.d.ts +7 -3
- package/src/builders/karma/schema.json +20 -5
- package/src/builders/server/index.d.ts +1 -1
- package/src/builders/server/index.js +42 -10
- package/src/builders/server/platform-server-exports-loader.d.ts +13 -0
- package/src/builders/server/platform-server-exports-loader.js +24 -0
- package/src/builders/server/schema.d.ts +0 -5
- package/src/builders/server/schema.json +0 -5
- package/src/sass/sass-service-legacy.d.ts +51 -0
- package/src/sass/sass-service-legacy.js +175 -0
- package/src/sass/sass-service.d.ts +6 -9
- package/src/sass/sass-service.js +69 -52
- package/src/{builders/karma/find-tests.d.ts → sass/worker-legacy.d.ts} +1 -1
- package/src/sass/worker-legacy.js +44 -0
- package/src/sass/worker.js +64 -14
- package/src/utils/build-options.d.ts +2 -4
- package/src/utils/environment-options.d.ts +1 -0
- package/src/utils/environment-options.js +11 -1
- package/src/utils/esbuild-targets.d.ts +12 -0
- package/src/utils/esbuild-targets.js +39 -0
- package/src/utils/i18n-inlining.d.ts +1 -1
- package/src/utils/i18n-inlining.js +3 -4
- package/src/utils/normalize-builder-schema.d.ts +3 -2
- package/src/utils/normalize-builder-schema.js +5 -4
- package/src/utils/normalize-polyfills.d.ts +8 -0
- package/src/utils/normalize-polyfills.js +24 -0
- package/src/utils/process-bundle.d.ts +0 -1
- package/src/utils/process-bundle.js +29 -57
- package/src/utils/supported-browsers.d.ts +2 -1
- package/src/utils/supported-browsers.js +18 -2
- package/src/utils/webpack-browser-config.d.ts +0 -2
- package/src/utils/webpack-browser-config.js +2 -8
- package/src/utils/webpack-diagnostics.d.ts +1 -1
- package/src/utils/webpack-diagnostics.js +2 -3
- package/src/webpack/configs/common.js +37 -24
- package/src/webpack/configs/dev-server.js +1 -1
- package/src/webpack/configs/styles.js +63 -80
- package/src/webpack/plugins/any-component-style-budget-checker.js +1 -1
- package/src/webpack/plugins/css-optimizer-plugin.d.ts +0 -1
- package/src/webpack/plugins/css-optimizer-plugin.js +3 -26
- package/src/webpack/plugins/hmr/hmr-loader.d.ts +1 -1
- package/src/webpack/plugins/hmr/hmr-loader.js +2 -5
- package/src/webpack/plugins/javascript-optimizer-plugin.d.ts +4 -6
- package/src/webpack/plugins/javascript-optimizer-plugin.js +7 -16
- package/src/webpack/plugins/javascript-optimizer-worker.d.ts +3 -2
- package/src/webpack/plugins/javascript-optimizer-worker.js +21 -46
- package/src/webpack/plugins/karma/karma.js +4 -5
- package/src/webpack/plugins/transfer-size-plugin.js +2 -1
- package/src/webpack/plugins/typescript.js +14 -25
- package/src/webpack/utils/helpers.d.ts +0 -3
- package/src/webpack/utils/helpers.js +1 -36
- package/src/webpack/plugins/single-test-transform.d.ts +0 -27
- package/src/webpack/plugins/single-test-transform.js +0 -44
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.transformSupportedBrowsersToTargets = void 0;
|
|
11
|
+
/**
|
|
12
|
+
* Transform browserlists result to esbuild target.
|
|
13
|
+
* @see https://esbuild.github.io/api/#target
|
|
14
|
+
*/
|
|
15
|
+
function transformSupportedBrowsersToTargets(supportedBrowsers) {
|
|
16
|
+
const transformed = [];
|
|
17
|
+
// https://esbuild.github.io/api/#target
|
|
18
|
+
const esBuildSupportedBrowsers = new Set(['safari', 'firefox', 'edge', 'chrome', 'ios', 'node']);
|
|
19
|
+
for (const browser of supportedBrowsers) {
|
|
20
|
+
let [browserName, version] = browser.split(' ');
|
|
21
|
+
// browserslist uses the name `ios_saf` for iOS Safari whereas esbuild uses `ios`
|
|
22
|
+
if (browserName === 'ios_saf') {
|
|
23
|
+
browserName = 'ios';
|
|
24
|
+
}
|
|
25
|
+
// browserslist uses ranges `15.2-15.3` versions but only the lowest is required
|
|
26
|
+
// to perform minimum supported feature checks. esbuild also expects a single version.
|
|
27
|
+
[version] = version.split('-');
|
|
28
|
+
if (esBuildSupportedBrowsers.has(browserName)) {
|
|
29
|
+
if (browserName === 'safari' && version === 'TP') {
|
|
30
|
+
// esbuild only supports numeric versions so `TP` is converted to a high number (999) since
|
|
31
|
+
// a Technology Preview (TP) of Safari is assumed to support all currently known features.
|
|
32
|
+
version = '999';
|
|
33
|
+
}
|
|
34
|
+
transformed.push(browserName + version);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return transformed;
|
|
38
|
+
}
|
|
39
|
+
exports.transformSupportedBrowsersToTargets = transformSupportedBrowsersToTargets;
|
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
import { BuilderContext } from '@angular-devkit/architect';
|
|
9
9
|
import { EmittedFiles } from '@angular-devkit/build-webpack';
|
|
10
10
|
import { I18nOptions } from './i18n-options';
|
|
11
|
-
export declare function i18nInlineEmittedFiles(context: BuilderContext, emittedFiles: EmittedFiles[], i18n: I18nOptions, baseOutputPath: string, outputPaths: string[], scriptsEntryPointName: string[], emittedPath: string,
|
|
11
|
+
export declare function i18nInlineEmittedFiles(context: BuilderContext, emittedFiles: EmittedFiles[], i18n: I18nOptions, baseOutputPath: string, outputPaths: string[], scriptsEntryPointName: string[], emittedPath: string, missingTranslation: 'error' | 'warning' | 'ignore' | undefined): Promise<boolean>;
|
|
@@ -37,7 +37,7 @@ const action_executor_1 = require("./action-executor");
|
|
|
37
37
|
const copy_assets_1 = require("./copy-assets");
|
|
38
38
|
const error_1 = require("./error");
|
|
39
39
|
const spinner_1 = require("./spinner");
|
|
40
|
-
function emittedFilesToInlineOptions(emittedFiles, scriptsEntryPointName, emittedPath, outputPath,
|
|
40
|
+
function emittedFilesToInlineOptions(emittedFiles, scriptsEntryPointName, emittedPath, outputPath, missingTranslation, context) {
|
|
41
41
|
const options = [];
|
|
42
42
|
const originalFiles = [];
|
|
43
43
|
for (const emittedFile of emittedFiles) {
|
|
@@ -50,7 +50,6 @@ function emittedFilesToInlineOptions(emittedFiles, scriptsEntryPointName, emitte
|
|
|
50
50
|
const action = {
|
|
51
51
|
filename: emittedFile.file,
|
|
52
52
|
code: fs.readFileSync(originalPath, 'utf8'),
|
|
53
|
-
es5,
|
|
54
53
|
outputPath,
|
|
55
54
|
missingTranslation,
|
|
56
55
|
setLocale: emittedFile.name === 'main' || emittedFile.name === 'vendor',
|
|
@@ -72,13 +71,13 @@ function emittedFilesToInlineOptions(emittedFiles, scriptsEntryPointName, emitte
|
|
|
72
71
|
}
|
|
73
72
|
return { options, originalFiles };
|
|
74
73
|
}
|
|
75
|
-
async function i18nInlineEmittedFiles(context, emittedFiles, i18n, baseOutputPath, outputPaths, scriptsEntryPointName, emittedPath,
|
|
74
|
+
async function i18nInlineEmittedFiles(context, emittedFiles, i18n, baseOutputPath, outputPaths, scriptsEntryPointName, emittedPath, missingTranslation) {
|
|
76
75
|
const executor = new action_executor_1.BundleActionExecutor({ i18n });
|
|
77
76
|
let hasErrors = false;
|
|
78
77
|
const spinner = new spinner_1.Spinner();
|
|
79
78
|
spinner.start('Generating localized bundles...');
|
|
80
79
|
try {
|
|
81
|
-
const { options, originalFiles: processedFiles } = emittedFilesToInlineOptions(emittedFiles, scriptsEntryPointName, emittedPath, baseOutputPath,
|
|
80
|
+
const { options, originalFiles: processedFiles } = emittedFilesToInlineOptions(emittedFiles, scriptsEntryPointName, emittedPath, baseOutputPath, missingTranslation, context);
|
|
82
81
|
for await (const result of executor.inlineAll(options)) {
|
|
83
82
|
context.logger.debug(`i18n file processed: ${result.file}`);
|
|
84
83
|
for (const diagnostic of result.diagnostics) {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
|
-
import { json } from '@angular-devkit/core';
|
|
8
|
+
import { json, logging } from '@angular-devkit/core';
|
|
9
9
|
import { AssetPatternClass, Schema as BrowserBuilderSchema, SourceMapClass } from '../builders/browser/schema';
|
|
10
10
|
import { BuildOptions } from './build-options';
|
|
11
11
|
import { NormalizedFileReplacement } from './normalize-file-replacements';
|
|
@@ -18,5 +18,6 @@ export declare type NormalizedBrowserBuilderSchema = BrowserBuilderSchema & Buil
|
|
|
18
18
|
assets: AssetPatternClass[];
|
|
19
19
|
fileReplacements: NormalizedFileReplacement[];
|
|
20
20
|
optimization: NormalizedOptimizationOptions;
|
|
21
|
+
polyfills: string[];
|
|
21
22
|
};
|
|
22
|
-
export declare function normalizeBrowserSchema(workspaceRoot: string, projectRoot: string, projectSourceRoot: string | undefined, options: BrowserBuilderSchema, metadata: json.JsonObject): NormalizedBrowserBuilderSchema;
|
|
23
|
+
export declare function normalizeBrowserSchema(workspaceRoot: string, projectRoot: string, projectSourceRoot: string | undefined, options: BrowserBuilderSchema, metadata: json.JsonObject, logger: logging.LoggerApi): NormalizedBrowserBuilderSchema;
|
|
@@ -12,17 +12,18 @@ const normalize_asset_patterns_1 = require("./normalize-asset-patterns");
|
|
|
12
12
|
const normalize_cache_1 = require("./normalize-cache");
|
|
13
13
|
const normalize_file_replacements_1 = require("./normalize-file-replacements");
|
|
14
14
|
const normalize_optimization_1 = require("./normalize-optimization");
|
|
15
|
+
const normalize_polyfills_1 = require("./normalize-polyfills");
|
|
15
16
|
const normalize_source_maps_1 = require("./normalize-source-maps");
|
|
16
17
|
const supported_browsers_1 = require("./supported-browsers");
|
|
17
|
-
function normalizeBrowserSchema(workspaceRoot, projectRoot, projectSourceRoot, options, metadata) {
|
|
18
|
-
const normalizedSourceMapOptions = (0, normalize_source_maps_1.normalizeSourceMaps)(options.sourceMap || false);
|
|
18
|
+
function normalizeBrowserSchema(workspaceRoot, projectRoot, projectSourceRoot, options, metadata, logger) {
|
|
19
19
|
return {
|
|
20
20
|
...options,
|
|
21
21
|
cache: (0, normalize_cache_1.normalizeCacheOptions)(metadata, workspaceRoot),
|
|
22
22
|
assets: (0, normalize_asset_patterns_1.normalizeAssetPatterns)(options.assets || [], workspaceRoot, projectRoot, projectSourceRoot),
|
|
23
23
|
fileReplacements: (0, normalize_file_replacements_1.normalizeFileReplacements)(options.fileReplacements || [], workspaceRoot),
|
|
24
24
|
optimization: (0, normalize_optimization_1.normalizeOptimization)(options.optimization),
|
|
25
|
-
sourceMap:
|
|
25
|
+
sourceMap: (0, normalize_source_maps_1.normalizeSourceMaps)(options.sourceMap || false),
|
|
26
|
+
polyfills: (0, normalize_polyfills_1.normalizePolyfills)(options.polyfills, workspaceRoot),
|
|
26
27
|
preserveSymlinks: options.preserveSymlinks === undefined
|
|
27
28
|
? process.execArgv.includes('--preserve-symlinks')
|
|
28
29
|
: options.preserveSymlinks,
|
|
@@ -37,7 +38,7 @@ function normalizeBrowserSchema(workspaceRoot, projectRoot, projectSourceRoot, o
|
|
|
37
38
|
// A value of 0 is falsy and will disable polling rather then enable
|
|
38
39
|
// 500 ms is a sensible default in this case
|
|
39
40
|
poll: options.poll === 0 ? 500 : options.poll,
|
|
40
|
-
supportedBrowsers: (0, supported_browsers_1.getSupportedBrowsers)(projectRoot),
|
|
41
|
+
supportedBrowsers: (0, supported_browsers_1.getSupportedBrowsers)(projectRoot, logger),
|
|
41
42
|
};
|
|
42
43
|
}
|
|
43
44
|
exports.normalizeBrowserSchema = normalizeBrowserSchema;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
8
|
+
export declare function normalizePolyfills(polyfills: string[] | string | undefined, root: string): string[];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.normalizePolyfills = void 0;
|
|
11
|
+
const fs_1 = require("fs");
|
|
12
|
+
const path_1 = require("path");
|
|
13
|
+
function normalizePolyfills(polyfills, root) {
|
|
14
|
+
if (!polyfills) {
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
const polyfillsList = Array.isArray(polyfills) ? polyfills : [polyfills];
|
|
18
|
+
return polyfillsList.map((p) => {
|
|
19
|
+
const resolvedPath = (0, path_1.resolve)(root, p);
|
|
20
|
+
// If file doesn't exist, let the bundle resolve it using node module resolution.
|
|
21
|
+
return (0, fs_1.existsSync)(resolvedPath) ? resolvedPath : p;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
exports.normalizePolyfills = normalizePolyfills;
|
|
@@ -37,7 +37,7 @@ exports.inlineLocales = exports.createI18nPlugins = void 0;
|
|
|
37
37
|
const remapping_1 = __importDefault(require("@ampproject/remapping"));
|
|
38
38
|
const core_1 = require("@babel/core");
|
|
39
39
|
const template_1 = __importDefault(require("@babel/template"));
|
|
40
|
-
const fs = __importStar(require("fs"));
|
|
40
|
+
const fs = __importStar(require("fs/promises"));
|
|
41
41
|
const path = __importStar(require("path"));
|
|
42
42
|
const worker_threads_1 = require("worker_threads");
|
|
43
43
|
const environment_options_1 = require("./environment-options");
|
|
@@ -73,7 +73,7 @@ async function loadLocalizeTools() {
|
|
|
73
73
|
return (0, load_esm_1.loadEsmModule)('@angular/localize/tools');
|
|
74
74
|
}
|
|
75
75
|
async function createI18nPlugins(locale, translation, missingTranslation, shouldInline, localeDataContent) {
|
|
76
|
-
const { Diagnostics, makeEs2015TranslatePlugin,
|
|
76
|
+
const { Diagnostics, makeEs2015TranslatePlugin, makeLocalePlugin } = await loadLocalizeTools();
|
|
77
77
|
const plugins = [];
|
|
78
78
|
const diagnostics = new Diagnostics();
|
|
79
79
|
if (shouldInline) {
|
|
@@ -82,11 +82,6 @@ async function createI18nPlugins(locale, translation, missingTranslation, should
|
|
|
82
82
|
makeEs2015TranslatePlugin(diagnostics, (translation || {}), {
|
|
83
83
|
missingTranslation: translation === undefined ? 'ignore' : missingTranslation,
|
|
84
84
|
}));
|
|
85
|
-
plugins.push(
|
|
86
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
87
|
-
makeEs5TranslatePlugin(diagnostics, (translation || {}), {
|
|
88
|
-
missingTranslation: translation === undefined ? 'ignore' : missingTranslation,
|
|
89
|
-
}));
|
|
90
85
|
}
|
|
91
86
|
plugins.push(makeLocalePlugin(locale));
|
|
92
87
|
if (localeDataContent) {
|
|
@@ -149,7 +144,7 @@ async function inlineLocales(options) {
|
|
|
149
144
|
// If locale data is provided, load it and prepend to file
|
|
150
145
|
const localeDataPath = (_a = i18n.locales[locale]) === null || _a === void 0 ? void 0 : _a.dataPath;
|
|
151
146
|
if (localeDataPath) {
|
|
152
|
-
localeDataContent = await loadLocaleData(localeDataPath, true
|
|
147
|
+
localeDataContent = await loadLocaleData(localeDataPath, true);
|
|
153
148
|
}
|
|
154
149
|
}
|
|
155
150
|
const { diagnostics: localeDiagnostics, plugins } = await createI18nPlugins(locale, translations, isSourceLocale ? 'ignore' : options.missingTranslation || 'warning', true, localeDataContent);
|
|
@@ -170,10 +165,10 @@ async function inlineLocales(options) {
|
|
|
170
165
|
throw new Error(`Unknown error occurred processing bundle for "${options.filename}".`);
|
|
171
166
|
}
|
|
172
167
|
const outputPath = path.join(options.outputPath, i18n.flatOutput ? '' : locale, options.filename);
|
|
173
|
-
fs.
|
|
168
|
+
await fs.writeFile(outputPath, transformResult.code);
|
|
174
169
|
if (options.map && transformResult.map) {
|
|
175
170
|
const outputMap = (0, remapping_1.default)([transformResult.map, options.map], () => null);
|
|
176
|
-
fs.
|
|
171
|
+
await fs.writeFile(outputPath + '.map', JSON.stringify(outputMap));
|
|
177
172
|
}
|
|
178
173
|
}
|
|
179
174
|
return { file: options.filename, diagnostics };
|
|
@@ -221,7 +216,7 @@ async function inlineLocalesDirect(ast, options) {
|
|
|
221
216
|
let localeDataSource;
|
|
222
217
|
const localeDataPath = i18n.locales[locale] && i18n.locales[locale].dataPath;
|
|
223
218
|
if (localeDataPath) {
|
|
224
|
-
const localeDataContent = await loadLocaleData(localeDataPath, true
|
|
219
|
+
const localeDataContent = await loadLocaleData(localeDataPath, true);
|
|
225
220
|
localeDataSource = new OriginalSource(localeDataContent, path.basename(localeDataPath));
|
|
226
221
|
}
|
|
227
222
|
outputSource = localeDataSource
|
|
@@ -231,26 +226,26 @@ async function inlineLocalesDirect(ast, options) {
|
|
|
231
226
|
}
|
|
232
227
|
const { source: outputCode, map: outputMap } = outputSource.sourceAndMap();
|
|
233
228
|
const outputPath = path.join(options.outputPath, i18n.flatOutput ? '' : locale, options.filename);
|
|
234
|
-
fs.
|
|
229
|
+
await fs.writeFile(outputPath, outputCode);
|
|
235
230
|
if (inputMap && outputMap) {
|
|
236
231
|
outputMap.file = options.filename;
|
|
237
232
|
if (mapSourceRoot) {
|
|
238
233
|
outputMap.sourceRoot = mapSourceRoot;
|
|
239
234
|
}
|
|
240
|
-
fs.
|
|
235
|
+
await fs.writeFile(outputPath + '.map', JSON.stringify(outputMap));
|
|
241
236
|
}
|
|
242
237
|
}
|
|
243
238
|
return { file: options.filename, diagnostics: diagnostics.messages, count: positions.length };
|
|
244
239
|
}
|
|
245
|
-
function inlineCopyOnly(options) {
|
|
240
|
+
async function inlineCopyOnly(options) {
|
|
246
241
|
if (!i18n) {
|
|
247
242
|
throw new Error('i18n options are missing');
|
|
248
243
|
}
|
|
249
244
|
for (const locale of i18n.inlineLocales) {
|
|
250
245
|
const outputPath = path.join(options.outputPath, i18n.flatOutput ? '' : locale, options.filename);
|
|
251
|
-
fs.
|
|
246
|
+
await fs.writeFile(outputPath, options.code);
|
|
252
247
|
if (options.map) {
|
|
253
|
-
fs.
|
|
248
|
+
await fs.writeFile(outputPath + '.map', options.map);
|
|
254
249
|
}
|
|
255
250
|
}
|
|
256
251
|
return { file: options.filename, diagnostics: [], count: 0 };
|
|
@@ -260,43 +255,21 @@ function findLocalizePositions(ast, options, utils) {
|
|
|
260
255
|
// Workaround to ensure a path hub is present for traversal
|
|
261
256
|
const { File } = require('@babel/core');
|
|
262
257
|
const file = new File({}, { code: options.code, ast });
|
|
263
|
-
|
|
264
|
-
(
|
|
265
|
-
|
|
266
|
-
const
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
|
-
},
|
|
281
|
-
});
|
|
282
|
-
}
|
|
283
|
-
else {
|
|
284
|
-
(0, core_1.traverse)(file.ast, {
|
|
285
|
-
TaggedTemplateExpression(path) {
|
|
286
|
-
if (core_1.types.isIdentifier(path.node.tag) && path.node.tag.name === localizeName) {
|
|
287
|
-
const [messageParts, expressions] = unwrapTemplateLiteral(path, utils);
|
|
288
|
-
positions.push({
|
|
289
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
290
|
-
start: path.node.start,
|
|
291
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
292
|
-
end: path.node.end,
|
|
293
|
-
messageParts,
|
|
294
|
-
expressions,
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
|
-
},
|
|
298
|
-
});
|
|
299
|
-
}
|
|
258
|
+
(0, core_1.traverse)(file.ast, {
|
|
259
|
+
TaggedTemplateExpression(path) {
|
|
260
|
+
if (core_1.types.isIdentifier(path.node.tag) && path.node.tag.name === localizeName) {
|
|
261
|
+
const [messageParts, expressions] = unwrapTemplateLiteral(path, utils);
|
|
262
|
+
positions.push({
|
|
263
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
264
|
+
start: path.node.start,
|
|
265
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
266
|
+
end: path.node.end,
|
|
267
|
+
messageParts,
|
|
268
|
+
expressions,
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
});
|
|
300
273
|
return positions;
|
|
301
274
|
}
|
|
302
275
|
function unwrapTemplateLiteral(path, utils) {
|
|
@@ -309,9 +282,9 @@ function unwrapLocalizeCall(path, utils) {
|
|
|
309
282
|
const [expressions] = utils.unwrapSubstitutionsFromLocalizeCall(path);
|
|
310
283
|
return [messageParts, expressions];
|
|
311
284
|
}
|
|
312
|
-
async function loadLocaleData(path, optimize
|
|
285
|
+
async function loadLocaleData(path, optimize) {
|
|
313
286
|
// The path is validated during option processing before the build starts
|
|
314
|
-
const content = fs.
|
|
287
|
+
const content = await fs.readFile(path, 'utf8');
|
|
315
288
|
// Downlevel and optimize the data
|
|
316
289
|
const transformResult = await (0, core_1.transformAsync)(content, {
|
|
317
290
|
filename: path,
|
|
@@ -325,8 +298,7 @@ async function loadLocaleData(path, optimize, es5) {
|
|
|
325
298
|
require.resolve('@babel/preset-env'),
|
|
326
299
|
{
|
|
327
300
|
bugfixes: true,
|
|
328
|
-
|
|
329
|
-
targets: es5 ? { ie: '11' } : { esmodules: true },
|
|
301
|
+
targets: { esmodules: true },
|
|
330
302
|
},
|
|
331
303
|
],
|
|
332
304
|
],
|
|
@@ -5,4 +5,5 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
import { logging } from '@angular-devkit/core';
|
|
9
|
+
export declare function getSupportedBrowsers(projectRoot: string, logger: logging.LoggerApi): string[];
|
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports.getSupportedBrowsers = void 0;
|
|
14
14
|
const browserslist_1 = __importDefault(require("browserslist"));
|
|
15
|
-
function getSupportedBrowsers(projectRoot) {
|
|
15
|
+
function getSupportedBrowsers(projectRoot, logger) {
|
|
16
16
|
browserslist_1.default.defaults = [
|
|
17
17
|
'last 1 Chrome version',
|
|
18
18
|
'last 1 Firefox version',
|
|
@@ -21,6 +21,22 @@ function getSupportedBrowsers(projectRoot) {
|
|
|
21
21
|
'last 2 iOS major versions',
|
|
22
22
|
'Firefox ESR',
|
|
23
23
|
];
|
|
24
|
-
|
|
24
|
+
// Get browsers from config or default.
|
|
25
|
+
const browsersFromConfigOrDefault = new Set((0, browserslist_1.default)(undefined, { path: projectRoot }));
|
|
26
|
+
// Get browsers that support ES6 modules.
|
|
27
|
+
const browsersThatSupportEs6 = new Set((0, browserslist_1.default)('supports es6-module'));
|
|
28
|
+
const unsupportedBrowsers = [];
|
|
29
|
+
for (const browser of browsersFromConfigOrDefault) {
|
|
30
|
+
if (!browsersThatSupportEs6.has(browser)) {
|
|
31
|
+
browsersFromConfigOrDefault.delete(browser);
|
|
32
|
+
unsupportedBrowsers.push(browser);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (unsupportedBrowsers.length) {
|
|
36
|
+
logger.warn(`One or more browsers which are configured in the project's Browserslist configuration ` +
|
|
37
|
+
'will be ignored as ES5 output is not supported by the Angular CLI.\n' +
|
|
38
|
+
`Ignored browsers: ${unsupportedBrowsers.join(', ')}`);
|
|
39
|
+
}
|
|
40
|
+
return Array.from(browsersFromConfigOrDefault);
|
|
25
41
|
}
|
|
26
42
|
exports.getSupportedBrowsers = getSupportedBrowsers;
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { BuilderContext } from '@angular-devkit/architect';
|
|
9
9
|
import { logging } from '@angular-devkit/core';
|
|
10
|
-
import { ScriptTarget } from 'typescript';
|
|
11
10
|
import { Configuration } from 'webpack';
|
|
12
11
|
import { Schema as BrowserBuilderSchema } from '../builders/browser/schema';
|
|
13
12
|
import { NormalizedBrowserBuilderSchema } from '../utils';
|
|
@@ -21,7 +20,6 @@ export declare function generateI18nBrowserWebpackConfigFromContext(options: Bro
|
|
|
21
20
|
projectRoot: string;
|
|
22
21
|
projectSourceRoot?: string;
|
|
23
22
|
i18n: I18nOptions;
|
|
24
|
-
target: ScriptTarget;
|
|
25
23
|
}>;
|
|
26
24
|
export declare function generateBrowserWebpackConfigFromContext(options: BrowserBuilderSchema, context: BuilderContext, webpackPartialGenerator: WebpackPartialGenerator, extraBuildOptions?: Partial<NormalizedBrowserBuilderSchema>): Promise<{
|
|
27
25
|
config: Configuration;
|
|
@@ -32,7 +32,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
32
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
33
|
exports.getIndexInputFile = exports.getIndexOutputFile = exports.generateBrowserWebpackConfigFromContext = exports.generateI18nBrowserWebpackConfigFromContext = exports.generateWebpackConfig = void 0;
|
|
34
34
|
const path = __importStar(require("path"));
|
|
35
|
-
const typescript_1 = require("typescript");
|
|
36
35
|
const webpack_1 = require("webpack");
|
|
37
36
|
const webpack_merge_1 = require("webpack-merge");
|
|
38
37
|
const utils_1 = require("../utils");
|
|
@@ -46,8 +45,6 @@ async function generateWebpackConfig(workspaceRoot, projectRoot, sourceRoot, pro
|
|
|
46
45
|
}
|
|
47
46
|
const tsConfigPath = path.resolve(workspaceRoot, options.tsConfig);
|
|
48
47
|
const tsConfig = await (0, read_tsconfig_1.readTsconfig)(tsConfigPath);
|
|
49
|
-
const ts = await Promise.resolve().then(() => __importStar(require('typescript')));
|
|
50
|
-
const scriptTarget = tsConfig.options.target || ts.ScriptTarget.ES5;
|
|
51
48
|
const buildOptions = { ...options, ...extraBuildOptions };
|
|
52
49
|
const wco = {
|
|
53
50
|
root: workspaceRoot,
|
|
@@ -58,7 +55,6 @@ async function generateWebpackConfig(workspaceRoot, projectRoot, sourceRoot, pro
|
|
|
58
55
|
tsConfig,
|
|
59
56
|
tsConfigPath,
|
|
60
57
|
projectName,
|
|
61
|
-
scriptTarget,
|
|
62
58
|
};
|
|
63
59
|
wco.buildOptions.progress = (0, utils_1.defaultProgress)(wco.buildOptions.progress);
|
|
64
60
|
const partials = await Promise.all(webpackPartialGenerator(wco));
|
|
@@ -69,9 +65,7 @@ exports.generateWebpackConfig = generateWebpackConfig;
|
|
|
69
65
|
async function generateI18nBrowserWebpackConfigFromContext(options, context, webpackPartialGenerator, extraBuildOptions = {}) {
|
|
70
66
|
var _a;
|
|
71
67
|
const { buildOptions, i18n } = await (0, i18n_options_1.configureI18nBuild)(context, options);
|
|
72
|
-
let target = typescript_1.ScriptTarget.ES5;
|
|
73
68
|
const result = await generateBrowserWebpackConfigFromContext(buildOptions, context, (wco) => {
|
|
74
|
-
target = wco.scriptTarget;
|
|
75
69
|
return webpackPartialGenerator(wco);
|
|
76
70
|
}, extraBuildOptions);
|
|
77
71
|
const config = result.config;
|
|
@@ -107,7 +101,7 @@ async function generateI18nBrowserWebpackConfigFromContext(options, context, web
|
|
|
107
101
|
},
|
|
108
102
|
});
|
|
109
103
|
}
|
|
110
|
-
return { ...result, i18n
|
|
104
|
+
return { ...result, i18n };
|
|
111
105
|
}
|
|
112
106
|
exports.generateI18nBrowserWebpackConfigFromContext = generateI18nBrowserWebpackConfigFromContext;
|
|
113
107
|
async function generateBrowserWebpackConfigFromContext(options, context, webpackPartialGenerator, extraBuildOptions = {}) {
|
|
@@ -121,7 +115,7 @@ async function generateBrowserWebpackConfigFromContext(options, context, webpack
|
|
|
121
115
|
const projectRoot = path.join(workspaceRoot, (_a = projectMetadata.root) !== null && _a !== void 0 ? _a : '');
|
|
122
116
|
const sourceRoot = projectMetadata.sourceRoot;
|
|
123
117
|
const projectSourceRoot = sourceRoot ? path.join(workspaceRoot, sourceRoot) : undefined;
|
|
124
|
-
const normalizedOptions = (0, utils_1.normalizeBrowserSchema)(workspaceRoot, projectRoot, projectSourceRoot, options, projectMetadata);
|
|
118
|
+
const normalizedOptions = (0, utils_1.normalizeBrowserSchema)(workspaceRoot, projectRoot, projectSourceRoot, options, projectMetadata, context.logger);
|
|
125
119
|
const config = await generateWebpackConfig(workspaceRoot, projectRoot, projectSourceRoot, projectName, normalizedOptions, webpackPartialGenerator, context.logger, extraBuildOptions);
|
|
126
120
|
// If builder watch support is present in the context, add watch plugin
|
|
127
121
|
// This is internal only and currently only used for testing
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
|
-
import { Compilation } from 'webpack';
|
|
8
|
+
import type { Compilation } from 'webpack';
|
|
9
9
|
export declare function addWarning(compilation: Compilation, message: string): void;
|
|
10
10
|
export declare function addError(compilation: Compilation, message: string): void;
|
|
@@ -8,12 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.addError = exports.addWarning = void 0;
|
|
11
|
-
const webpack_1 = require("webpack");
|
|
12
11
|
function addWarning(compilation, message) {
|
|
13
|
-
compilation.warnings.push(new
|
|
12
|
+
compilation.warnings.push(new compilation.compiler.webpack.WebpackError(message));
|
|
14
13
|
}
|
|
15
14
|
exports.addWarning = addWarning;
|
|
16
15
|
function addError(compilation, message) {
|
|
17
|
-
compilation.errors.push(new
|
|
16
|
+
compilation.errors.push(new compilation.compiler.webpack.WebpackError(message));
|
|
18
17
|
}
|
|
19
18
|
exports.addError = addError;
|
|
@@ -37,7 +37,6 @@ exports.getCommonConfig = void 0;
|
|
|
37
37
|
const webpack_1 = require("@ngtools/webpack");
|
|
38
38
|
const copy_webpack_plugin_1 = __importDefault(require("copy-webpack-plugin"));
|
|
39
39
|
const path = __importStar(require("path"));
|
|
40
|
-
const typescript_1 = require("typescript");
|
|
41
40
|
const webpack_2 = require("webpack");
|
|
42
41
|
const webpack_subresource_integrity_1 = require("webpack-subresource-integrity");
|
|
43
42
|
const environment_options_1 = require("../../utils/environment-options");
|
|
@@ -47,15 +46,15 @@ const devtools_ignore_plugin_1 = require("../plugins/devtools-ignore-plugin");
|
|
|
47
46
|
const named_chunks_plugin_1 = require("../plugins/named-chunks-plugin");
|
|
48
47
|
const progress_plugin_1 = require("../plugins/progress-plugin");
|
|
49
48
|
const transfer_size_plugin_1 = require("../plugins/transfer-size-plugin");
|
|
50
|
-
const
|
|
49
|
+
const typescript_1 = require("../plugins/typescript");
|
|
51
50
|
const watch_files_logs_plugin_1 = require("../plugins/watch-files-logs-plugin");
|
|
52
51
|
const helpers_1 = require("../utils/helpers");
|
|
53
52
|
const VENDORS_TEST = /[\\/]node_modules[\\/]/;
|
|
54
53
|
// eslint-disable-next-line max-lines-per-function
|
|
55
54
|
async function getCommonConfig(wco) {
|
|
56
55
|
var _a, _b;
|
|
57
|
-
const { root, projectRoot, buildOptions, tsConfig, projectName, sourceRoot, tsConfigPath
|
|
58
|
-
const { cache, codeCoverage, crossOrigin = 'none', platform = 'browser', aot = true, codeCoverageExclude = [], main, polyfills, sourceMap: { styles: stylesSourceMap, scripts: scriptsSourceMap, vendor: vendorSourceMap, hidden: hiddenSourceMap, }, optimization: { styles: stylesOptimization, scripts: scriptsOptimization }, commonChunk, vendorChunk, subresourceIntegrity, verbose, poll, webWorkerTsConfig, externalDependencies = [], allowedCommonJsDependencies,
|
|
56
|
+
const { root, projectRoot, buildOptions, tsConfig, projectName, sourceRoot, tsConfigPath } = wco;
|
|
57
|
+
const { cache, codeCoverage, crossOrigin = 'none', platform = 'browser', aot = true, codeCoverageExclude = [], main, polyfills, sourceMap: { styles: stylesSourceMap, scripts: scriptsSourceMap, vendor: vendorSourceMap, hidden: hiddenSourceMap, }, optimization: { styles: stylesOptimization, scripts: scriptsOptimization }, commonChunk, vendorChunk, subresourceIntegrity, verbose, poll, webWorkerTsConfig, externalDependencies = [], allowedCommonJsDependencies, } = buildOptions;
|
|
59
58
|
const isPlatformServer = buildOptions.platform === 'server';
|
|
60
59
|
const extraPlugins = [];
|
|
61
60
|
const extraRules = [];
|
|
@@ -77,14 +76,32 @@ async function getCommonConfig(wco) {
|
|
|
77
76
|
// Fixes Critical dependency: the request of a dependency is an expression
|
|
78
77
|
extraPlugins.push(new webpack_2.ContextReplacementPlugin(/@?hapi|express[\\/]/));
|
|
79
78
|
}
|
|
80
|
-
if (
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
if (polyfills === null || polyfills === void 0 ? void 0 : polyfills.length) {
|
|
80
|
+
// `zone.js/testing` is a **special** polyfill because when not imported in the main it fails with the below errors:
|
|
81
|
+
// `Error: Expected to be running in 'ProxyZone', but it was not found.`
|
|
82
|
+
// This was also the reason why previously it was imported in `test.ts` as the first module.
|
|
83
|
+
// From Jia li:
|
|
84
|
+
// This is because the jasmine functions such as beforeEach/it will not be patched by zone.js since
|
|
85
|
+
// jasmine will not be loaded yet, so the ProxyZone will not be there. We have to load zone-testing.js after
|
|
86
|
+
// jasmine is ready.
|
|
87
|
+
// We could force loading 'zone.js/testing' prior to jasmine by changing the order of scripts in 'karma-context.html'.
|
|
88
|
+
// But this has it's own problems as zone.js needs to be loaded prior to jasmine due to patching of timing functions
|
|
89
|
+
// See: https://github.com/jasmine/jasmine/issues/1944
|
|
90
|
+
// Thus the correct order is zone.js -> jasmine -> zone.js/testing.
|
|
91
|
+
const zoneTestingEntryPoint = 'zone.js/testing';
|
|
92
|
+
const polyfillsExludingZoneTesting = polyfills.filter((p) => p !== zoneTestingEntryPoint);
|
|
93
|
+
if (Array.isArray(entryPoints['polyfills'])) {
|
|
94
|
+
entryPoints['polyfills'].push(...polyfillsExludingZoneTesting);
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
entryPoints['polyfills'] = polyfillsExludingZoneTesting;
|
|
98
|
+
}
|
|
99
|
+
if (polyfillsExludingZoneTesting.length !== polyfills.length) {
|
|
100
|
+
if (Array.isArray(entryPoints['main'])) {
|
|
101
|
+
entryPoints['main'].unshift(zoneTestingEntryPoint);
|
|
85
102
|
}
|
|
86
103
|
else {
|
|
87
|
-
entryPoints['
|
|
104
|
+
entryPoints['main'] = [zoneTestingEntryPoint];
|
|
88
105
|
}
|
|
89
106
|
}
|
|
90
107
|
}
|
|
@@ -185,17 +202,17 @@ async function getCommonConfig(wco) {
|
|
|
185
202
|
/[\\/]node_modules[/\\](?:css-loader|mini-css-extract-plugin|webpack-dev-server|webpack)[/\\]/,
|
|
186
203
|
],
|
|
187
204
|
});
|
|
188
|
-
extraPlugins.push((0,
|
|
205
|
+
extraPlugins.push((0, typescript_1.createIvyPlugin)(wco, aot, tsConfigPath));
|
|
189
206
|
}
|
|
190
207
|
if (webWorkerTsConfig) {
|
|
191
|
-
extraPlugins.push((0,
|
|
208
|
+
extraPlugins.push((0, typescript_1.createIvyPlugin)(wco, false, path.resolve(wco.root, webWorkerTsConfig)));
|
|
192
209
|
}
|
|
193
210
|
const extraMinimizers = [];
|
|
194
211
|
if (scriptsOptimization) {
|
|
195
212
|
extraMinimizers.push(new plugins_1.JavaScriptOptimizerPlugin({
|
|
196
213
|
define: buildOptions.aot ? GLOBAL_DEFS_FOR_TERSER_WITH_AOT : GLOBAL_DEFS_FOR_TERSER,
|
|
197
214
|
sourcemap: scriptsSourceMap,
|
|
198
|
-
|
|
215
|
+
supportedBrowsers: buildOptions.supportedBrowsers,
|
|
199
216
|
keepIdentifierNames: !environment_options_1.allowMangle || isPlatformServer,
|
|
200
217
|
keepNames: isPlatformServer,
|
|
201
218
|
removeLicenses: buildOptions.extractLicenses,
|
|
@@ -205,10 +222,6 @@ async function getCommonConfig(wco) {
|
|
|
205
222
|
if (platform === 'browser' && (scriptsOptimization || stylesOptimization.minify)) {
|
|
206
223
|
extraMinimizers.push(new transfer_size_plugin_1.TransferSizePlugin());
|
|
207
224
|
}
|
|
208
|
-
const externals = [...externalDependencies];
|
|
209
|
-
if (isPlatformServer && !bundleDependencies) {
|
|
210
|
-
externals.push(({ context, request }, callback) => (0, helpers_1.externalizePackages)(context !== null && context !== void 0 ? context : wco.projectRoot, request, callback));
|
|
211
|
-
}
|
|
212
225
|
let crossOriginLoading = false;
|
|
213
226
|
if (subresourceIntegrity && crossOrigin === 'none') {
|
|
214
227
|
crossOriginLoading = 'anonymous';
|
|
@@ -219,24 +232,24 @@ async function getCommonConfig(wco) {
|
|
|
219
232
|
return {
|
|
220
233
|
mode: scriptsOptimization || stylesOptimization.minify ? 'production' : 'development',
|
|
221
234
|
devtool: false,
|
|
222
|
-
target: [
|
|
223
|
-
isPlatformServer ? 'node' : 'web',
|
|
224
|
-
scriptTarget === typescript_1.ScriptTarget.ES5 ? 'es5' : 'es2015',
|
|
225
|
-
],
|
|
235
|
+
target: [isPlatformServer ? 'node' : 'web', 'es2015'],
|
|
226
236
|
profile: buildOptions.statsJson,
|
|
227
237
|
resolve: {
|
|
228
238
|
roots: [projectRoot],
|
|
229
239
|
extensions: ['.ts', '.tsx', '.mjs', '.js'],
|
|
230
240
|
symlinks: !buildOptions.preserveSymlinks,
|
|
231
241
|
modules: [tsConfig.options.baseUrl || projectRoot, 'node_modules'],
|
|
232
|
-
|
|
242
|
+
mainFields: isPlatformServer
|
|
243
|
+
? ['es2020', 'es2015', 'module', 'main']
|
|
244
|
+
: ['es2020', 'es2015', 'browser', 'module', 'main'],
|
|
245
|
+
conditionNames: ['es2020', 'es2015', '...'],
|
|
233
246
|
},
|
|
234
247
|
resolveLoader: {
|
|
235
248
|
symlinks: !buildOptions.preserveSymlinks,
|
|
236
249
|
},
|
|
237
250
|
context: root,
|
|
238
251
|
entry: entryPoints,
|
|
239
|
-
externals,
|
|
252
|
+
externals: externalDependencies,
|
|
240
253
|
output: {
|
|
241
254
|
uniqueName: projectName,
|
|
242
255
|
hashFunction: 'xxhash64',
|
|
@@ -281,6 +294,7 @@ async function getCommonConfig(wco) {
|
|
|
281
294
|
strictExportPresence: true,
|
|
282
295
|
parser: {
|
|
283
296
|
javascript: {
|
|
297
|
+
requireContext: false,
|
|
284
298
|
// Disable auto URL asset module creation. This doesn't effect `new Worker(new URL(...))`
|
|
285
299
|
// https://webpack.js.org/guides/asset-modules/#url-assets
|
|
286
300
|
url: false,
|
|
@@ -313,7 +327,6 @@ async function getCommonConfig(wco) {
|
|
|
313
327
|
loader: require.resolve('../../babel/webpack-loader'),
|
|
314
328
|
options: {
|
|
315
329
|
cacheDirectory: (cache.enabled && path.join(cache.path, 'babel-webpack')) || false,
|
|
316
|
-
scriptTarget,
|
|
317
330
|
aot: buildOptions.aot,
|
|
318
331
|
optimize: buildOptions.buildOptimizer,
|
|
319
332
|
supportedBrowsers: buildOptions.supportedBrowsers,
|
|
@@ -46,7 +46,7 @@ async function getDevServerConfig(wco) {
|
|
|
46
46
|
if (hmr) {
|
|
47
47
|
extraRules.push({
|
|
48
48
|
loader: hmr_loader_1.HmrLoader,
|
|
49
|
-
include: [
|
|
49
|
+
include: [(0, path_1.resolve)(wco.root, main)],
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
const extraPlugins = [];
|