|
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 { buildOptimizerLoaderPath } from '@angular-devkit/build-optimizer'; |
9 | 8 | import { getSystemPath } from '@angular-devkit/core';
|
10 | 9 | import { CompilerOptions } from '@angular/compiler-cli';
|
11 | 10 | import { AngularWebpackLoaderPath, AngularWebpackPlugin } from '@ngtools/webpack';
|
@@ -78,55 +77,23 @@ function createIvyPlugin(
|
78 | 77 | });
|
79 | 78 | }
|
80 | 79 |
|
81 |
| -export function getNonAotConfig(wco: WebpackConfigOptions) { |
82 |
| - const { tsConfigPath } = wco; |
83 |
| - |
84 |
| - return { |
85 |
| - module: { |
86 |
| - rules: [ |
87 |
| - { |
88 |
| - test: /\.[jt]sx?$/, |
89 |
| - loader: AngularWebpackLoaderPath, |
90 |
| - }, |
91 |
| - ], |
92 |
| - }, |
93 |
| - plugins: [ |
94 |
| - createIvyPlugin(wco, false, tsConfigPath), |
95 |
| - ], |
96 |
| - }; |
97 |
| -} |
98 |
| - |
99 |
| -export function getAotConfig(wco: WebpackConfigOptions) { |
100 |
| - const { tsConfigPath, buildOptions } = wco; |
| 80 | +export function getTypeScriptConfig(wco: WebpackConfigOptions) { |
| 81 | + const { buildOptions, tsConfigPath } = wco; |
| 82 | + const aot = !!buildOptions.aot; |
101 | 83 |
|
102 | 84 | ensureIvy(wco);
|
103 | 85 |
|
104 | 86 | return {
|
105 | 87 | module: {
|
106 | 88 | rules: [
|
107 | 89 | {
|
108 |
| - test: /\.tsx?$/, |
109 |
| - use: [ |
110 |
| - ...(buildOptions.buildOptimizer |
111 |
| - ? [ |
112 |
| - { |
113 |
| - loader: buildOptimizerLoaderPath, |
114 |
| - options: { sourceMap: buildOptions.sourceMap.scripts }, |
115 |
| - }, |
116 |
| - ] |
117 |
| - : []), |
118 |
| - AngularWebpackLoaderPath, |
119 |
| - ], |
120 |
| - }, |
121 |
| - // "allowJs" support with ivy plugin - ensures build optimizer is not run twice |
122 |
| - { |
123 |
| - test: /\.jsx?$/, |
124 |
| - use: [AngularWebpackLoaderPath], |
| 90 | + test: /\.[jt]sx?$/, |
| 91 | + loader: AngularWebpackLoaderPath, |
125 | 92 | },
|
126 | 93 | ],
|
127 | 94 | },
|
128 | 95 | plugins: [
|
129 |
| - createIvyPlugin(wco, true, tsConfigPath), |
| 96 | + createIvyPlugin(wco, aot, tsConfigPath), |
130 | 97 | ],
|
131 | 98 | };
|
132 | 99 | }
|
|
0 commit comments