source: trip-planner-front/node_modules/@angular-devkit/build-angular/src/webpack/configs/browser.js@ ceaed42

Last change on this file since ceaed42 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 3.0 KB
Line 
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 */
9Object.defineProperty(exports, "__esModule", { value: true });
10exports.getBrowserConfig = void 0;
11const utils_1 = require("../../utils");
12const plugins_1 = require("../plugins");
13const helpers_1 = require("../utils/helpers");
14function getBrowserConfig(wco) {
15 const { buildOptions } = wco;
16 const { crossOrigin = 'none', subresourceIntegrity, extractLicenses, vendorChunk, commonChunk, allowedCommonJsDependencies, } = buildOptions;
17 const extraPlugins = [];
18 const { styles: stylesSourceMap, scripts: scriptsSourceMap, hidden: hiddenSourceMap, } = buildOptions.sourceMap;
19 if (subresourceIntegrity) {
20 const SubresourceIntegrityPlugin = require('webpack-subresource-integrity');
21 extraPlugins.push(new SubresourceIntegrityPlugin({
22 hashFuncNames: ['sha384'],
23 }));
24 }
25 if (scriptsSourceMap || stylesSourceMap) {
26 extraPlugins.push(helpers_1.getSourceMapDevTool(scriptsSourceMap, stylesSourceMap, buildOptions.differentialLoadingNeeded && !buildOptions.watch ? true : hiddenSourceMap, false));
27 }
28 let crossOriginLoading = false;
29 if (subresourceIntegrity && crossOrigin === 'none') {
30 crossOriginLoading = 'anonymous';
31 }
32 else if (crossOrigin !== 'none') {
33 crossOriginLoading = crossOrigin;
34 }
35 const buildBrowserFeatures = new utils_1.BuildBrowserFeatures(wco.projectRoot);
36 return {
37 devtool: false,
38 resolve: {
39 mainFields: ['es2015', 'browser', 'module', 'main'],
40 },
41 output: {
42 crossOriginLoading,
43 trustedTypes: 'angular#bundler',
44 },
45 optimization: {
46 runtimeChunk: 'single',
47 splitChunks: {
48 maxAsyncRequests: Infinity,
49 cacheGroups: {
50 default: !!commonChunk && {
51 chunks: 'async',
52 minChunks: 2,
53 priority: 10,
54 },
55 common: !!commonChunk && {
56 name: 'common',
57 chunks: 'async',
58 minChunks: 2,
59 enforce: true,
60 priority: 5,
61 },
62 vendors: false,
63 defaultVendors: !!vendorChunk && {
64 name: 'vendor',
65 chunks: (chunk) => chunk.name === 'main',
66 enforce: true,
67 test: /[\\/]node_modules[\\/]/,
68 },
69 },
70 },
71 },
72 plugins: [
73 new plugins_1.CommonJsUsageWarnPlugin({
74 allowedDependencies: allowedCommonJsDependencies,
75 }),
76 ...extraPlugins,
77 ],
78 node: false,
79 };
80}
81exports.getBrowserConfig = getBrowserConfig;
Note: See TracBrowser for help on using the repository browser.