source: trip-planner-front/node_modules/@angular-devkit/build-angular/src/webpack/configs/typescript.js@ 6a3a178

Last change on this file since 6a3a178 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.getTypescriptWorkerPlugin = exports.getTypeScriptConfig = void 0;
11const core_1 = require("@angular-devkit/core");
12const webpack_1 = require("@ngtools/webpack");
13function ensureIvy(wco) {
14 if (wco.tsConfig.options.enableIvy !== false) {
15 return;
16 }
17 wco.logger.warn('Project is attempting to disable the Ivy compiler. ' +
18 'Angular versions 12 and higher do not support the deprecated View Engine compiler for applications. ' +
19 'The Ivy compiler will be used to build this project. ' +
20 '\nFor additional information or if the build fails, please see https://angular.io/guide/ivy');
21 wco.tsConfig.options.enableIvy = true;
22}
23function createIvyPlugin(wco, aot, tsconfig) {
24 const { buildOptions } = wco;
25 const optimize = buildOptions.optimization.scripts;
26 const compilerOptions = {
27 sourceMap: buildOptions.sourceMap.scripts,
28 declaration: false,
29 declarationMap: false,
30 };
31 if (buildOptions.preserveSymlinks !== undefined) {
32 compilerOptions.preserveSymlinks = buildOptions.preserveSymlinks;
33 }
34 const fileReplacements = {};
35 if (buildOptions.fileReplacements) {
36 for (const replacement of buildOptions.fileReplacements) {
37 fileReplacements[core_1.getSystemPath(replacement.replace)] = core_1.getSystemPath(replacement.with);
38 }
39 }
40 let inlineStyleFileExtension;
41 switch (buildOptions.inlineStyleLanguage) {
42 case 'less':
43 inlineStyleFileExtension = 'less';
44 break;
45 case 'sass':
46 inlineStyleFileExtension = 'sass';
47 break;
48 case 'scss':
49 inlineStyleFileExtension = 'scss';
50 break;
51 case 'css':
52 default:
53 inlineStyleFileExtension = 'css';
54 break;
55 }
56 return new webpack_1.AngularWebpackPlugin({
57 tsconfig,
58 compilerOptions,
59 fileReplacements,
60 jitMode: !aot,
61 emitNgModuleScope: !optimize,
62 inlineStyleFileExtension,
63 });
64}
65function getTypeScriptConfig(wco) {
66 const { buildOptions: { aot = false, main, polyfills }, tsConfigPath, } = wco;
67 if (main || polyfills) {
68 ensureIvy(wco);
69 return {
70 module: {
71 rules: [
72 {
73 test: /\.[jt]sx?$/,
74 loader: webpack_1.AngularWebpackLoaderPath,
75 },
76 ],
77 },
78 plugins: [createIvyPlugin(wco, aot, tsConfigPath)],
79 };
80 }
81 return {};
82}
83exports.getTypeScriptConfig = getTypeScriptConfig;
84function getTypescriptWorkerPlugin(wco, workerTsConfigPath) {
85 return createIvyPlugin(wco, false, workerTsConfigPath);
86}
87exports.getTypescriptWorkerPlugin = getTypescriptWorkerPlugin;
Note: See TracBrowser for help on using the repository browser.