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.generateEntryPoints = void 0;
|
---|
11 | const helpers_1 = require("../webpack/utils/helpers");
|
---|
12 | function generateEntryPoints(appConfig) {
|
---|
13 | // Add all styles/scripts, except lazy-loaded ones.
|
---|
14 | const extraEntryPoints = (extraEntryPoints, defaultBundleName) => {
|
---|
15 | const entryPoints = helpers_1.normalizeExtraEntryPoints(extraEntryPoints, defaultBundleName)
|
---|
16 | .filter((entry) => entry.inject)
|
---|
17 | .map((entry) => entry.bundleName);
|
---|
18 | // remove duplicates
|
---|
19 | return [...new Set(entryPoints)];
|
---|
20 | };
|
---|
21 | const entryPoints = [
|
---|
22 | 'runtime',
|
---|
23 | 'polyfills-es5',
|
---|
24 | 'polyfills',
|
---|
25 | 'sw-register',
|
---|
26 | ...extraEntryPoints(appConfig.styles, 'styles'),
|
---|
27 | ...extraEntryPoints(appConfig.scripts, 'scripts'),
|
---|
28 | 'vendor',
|
---|
29 | 'main',
|
---|
30 | ];
|
---|
31 | const duplicates = [
|
---|
32 | ...new Set(entryPoints.filter((x) => entryPoints.indexOf(x) !== entryPoints.lastIndexOf(x))),
|
---|
33 | ];
|
---|
34 | if (duplicates.length > 0) {
|
---|
35 | throw new Error(`Multiple bundles have been named the same: '${duplicates.join(`', '`)}'.`);
|
---|
36 | }
|
---|
37 | return entryPoints;
|
---|
38 | }
|
---|
39 | exports.generateEntryPoints = generateEntryPoints;
|
---|