1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const utils_1 = require("../models/webpack-configs/utils");
|
4 |
|
5 |
|
6 | function packageChunkSort(appConfig) {
|
7 | let entryPoints = ['inline', 'polyfills', 'sw-register'];
|
8 | const pushExtraEntries = (extraEntry) => {
|
9 | if (entryPoints.indexOf(extraEntry.entry) === -1) {
|
10 | entryPoints.push(extraEntry.entry);
|
11 | }
|
12 | };
|
13 | if (appConfig.scripts) {
|
14 | utils_1.extraEntryParser(appConfig.scripts, './', 'scripts').forEach(pushExtraEntries);
|
15 | }
|
16 | if (appConfig.styles) {
|
17 | utils_1.extraEntryParser(appConfig.styles, './', 'styles').forEach(pushExtraEntries);
|
18 | }
|
19 | entryPoints.push(...['vendor', 'main']);
|
20 | function sort(left, right) {
|
21 | let leftIndex = entryPoints.indexOf(left.names[0]);
|
22 | let rightindex = entryPoints.indexOf(right.names[0]);
|
23 | if (leftIndex > rightindex) {
|
24 | return 1;
|
25 | }
|
26 | else if (leftIndex < rightindex) {
|
27 | return -1;
|
28 | }
|
29 | else {
|
30 | return 0;
|
31 | }
|
32 | }
|
33 |
|
34 |
|
35 | sort.entryPoints = entryPoints;
|
36 | return sort;
|
37 | }
|
38 | exports.packageChunkSort = packageChunkSort;
|
39 |
|
\ | No newline at end of file |