I am trying to use the @ngtools/webpack plugin to create an AoT version of my Angular 4 app within webpack 2, but I am having difficulty understanding what this plugin produces.
In particular, I have a main.aot.ts
entry point in my webpack for AoT, which looks like this:
// main.aot.ts
import { platformBrowser } from '@angular/platform-browser';
import { AppModuleNgFactory } from '../compiled/src/app/app.module.ngfactory';
const platform = platformBrowser();
platform.bootstrapModuleFactory(AppModuleNgFactory);
and an extract of my webpack.config.js
looks like this:
if (envOptions.MODE === 'prod') {
config.module.rules.push(
{test: /\.ts$/, loader: '@ngtools/webpack'}
);
config.plugins.push(
new AotPlugin({
tsConfigPath: path.resolve(__dirname, './app/tsconfig.json'),
entryModule: path.resolve(__dirname, './app/src/app.module#AppModule')
}),
new webpack.optimize.UglifyJsPlugin({
beautify: false,
mangle: {
screw_ie8: true,
keep_fnames: true
},
compress: {
warnings: false,
screw_ie8: true
},
comments: false
})
);
}
Does this @ngtools/webpack
plugin generate module files in the same way that the ngc
compiler does, for inclusion in main.aot.ts
? If not, how does it work? There aren't many examples of this on the web.
via serlingpa
No comments:
Post a Comment