|
1 | 1 | import * as path from 'path';
|
2 | 2 | import { stripIndent } from 'common-tags';
|
3 |
| -import {AotPlugin} from '@ngtools/webpack'; |
| 3 | +import { AotPlugin, AngularCompilerPlugin } from '@ngtools/webpack'; |
4 | 4 | import { WebpackConfigOptions } from '../webpack-config';
|
5 | 5 |
|
6 | 6 | const SilentError = require('silent-error');
|
@@ -63,17 +63,24 @@ function _createAotPlugin(wco: WebpackConfigOptions, options: any) {
|
63 | 63 | };
|
64 | 64 | }
|
65 | 65 |
|
66 |
| - return new AotPlugin(Object.assign({}, { |
67 |
| - mainPath: path.join(projectRoot, appConfig.root, appConfig.main), |
68 |
| - i18nFile: buildOptions.i18nFile, |
69 |
| - i18nFormat: buildOptions.i18nFormat, |
70 |
| - locale: buildOptions.locale, |
71 |
| - replaceExport: appConfig.platform === 'server', |
72 |
| - missingTranslation: buildOptions.missingTranslation, |
73 |
| - hostReplacementPaths, |
74 |
| - // If we don't explicitely list excludes, it will default to `['**/*.spec.ts']`. |
75 |
| - exclude: [] |
76 |
| - }, options)); |
| 66 | + const pluginOptions = Object.assign({}, { |
| 67 | + mainPath: path.join(projectRoot, appConfig.root, appConfig.main), |
| 68 | + i18nFile: buildOptions.i18nFile, |
| 69 | + i18nFormat: buildOptions.i18nFormat, |
| 70 | + locale: buildOptions.locale, |
| 71 | + replaceExport: appConfig.platform === 'server', |
| 72 | + missingTranslation: buildOptions.missingTranslation, |
| 73 | + hostReplacementPaths, |
| 74 | + sourceMap: buildOptions.sourcemaps, |
| 75 | + // If we don't explicitely list excludes, it will default to `['**/*.spec.ts']`. |
| 76 | + exclude: [] |
| 77 | + }, options); |
| 78 | + |
| 79 | + if (wco.buildOptions.experimentalAngularCompiler && !options.skipCodeGeneration) { |
| 80 | + return new AngularCompilerPlugin(pluginOptions); |
| 81 | + } else { |
| 82 | + return new AotPlugin(pluginOptions); |
| 83 | + } |
77 | 84 | }
|
78 | 85 |
|
79 | 86 | export const getNonAotConfig = function(wco: WebpackConfigOptions) {
|
|
0 commit comments