@ngtools/webpack keeps @angular/compile module in AOT build
See original GitHub issueBug Report
- [x] bug report -> please search issues before submitting
- [ ] feature request
Versions.
@ngtools/webpack: 1.3.1
NodeJS: v6.10.3
npm: 5.0.0
Repro steps.
Webpack config
var webpack = require('webpack');
var webpackMerge = require('webpack-merge');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var commonConfig = require('./webpack.common.js');
var helpers = require('./helpers');
var ngtools = require('@ngtools/webpack');
var AotPlugin = ngtools.AotPlugin;
const ENV = process.env.NODE_ENV = process.env.ENV = 'production';
module.exports = webpackMerge(commonConfig, {
devtool: 'source-map',
output: {
path: helpers.root('../../../target/rhamt-web'),
filename: 'js/[name].js',
chunkFilename: 'js/[id].chunk.js'
},
module: {
loaders: [
{
test: /\.ts$/,
exclude: /jquery*\.js/,
loaders: '@ngtools/webpack'
}
]
},
plugins: [
new webpack.NoEmitOnErrorsPlugin(),
new ExtractTextPlugin('css/[name].css'),
new AotPlugin({
tsConfigPath: './tsconfig-production.json',
basePath: '.',
mainPath: 'src/main.ts',
skipCodeGeneration: true
}),
new webpack.optimize.UglifyJsPlugin({ // https://github.com/angular/angular/issues/10618
mangle: {
keep_fnames: true
}
}),
new webpack.DefinePlugin({
'process.env': {
'ENV': JSON.stringify(ENV)
}
})
]
});
main.ts
import {platformBrowserDynamic} from "@angular/platform-browser-dynamic";
import {NgZone, enableProdMode} from "@angular/core";
import {AppModule} from "./app/app.module";
require('./keycloak.json.ftl');
require('../css/windup-web.css');
if (process.env.ENV === 'production') {
enableProdMode();
}
platformBrowserDynamic().bootstrapModule(AppModule).then(app => {
// this is just here to make some data easier to retrieve from tests
window["app"] = app;
window["MainNgZone"] = app.injector.get(NgZone);
if (window["windupAppInitialized"] != null)
window["windupAppInitialized"](app, window["MainNgZone"]);
})
.catch(err => {
console.log(err);
if (window["windupAppInitialized"] != null)
window["windupAppInitialized"]();
});
Desired functionality.
@angular/compiler module should not be present in AOT builded app.
Issue Analytics
- State:
- Created 6 years ago
- Comments:13 (4 by maintainers)
Top Results From Across the Web
ngtools\webpack AOT doesn't work OR freezes at 95% emitting
Can anyone help me at all? It appears to work, however, compiler.js is still included in the bundle. Also it is still looking...
Read more >Ahead-of-time (AOT) compilation - Angular
The Angular ahead-of-time (AOT) compiler converts your Angular HTML and TypeScript ... When you run the ng build (build only) or ng serve...
Read more >Angular AOT compilation with Webpack | Jiayi's Chronicles
The first step towards successful AOT compilation is adding AOTPlugin to your Webpack configuration file, usually named webpack.config.js . You ...
Read more >JavaScript Demos Using Webpack 4 With Angular 6.1.7 And ...
This one loader will handle the transpilation, HTML and CSS inlining, and Ahead of Time (AoT) compilation. In order to get the "@ngtools/webpack...
Read more >@ngtools/webpack | Yarn - Package Manager
Webpack plugin that AoT compiles your Angular components and modules. ... is a command-line interface tool that you use to initialize, develop, scaffold,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

You have the
skipCodeGeneration: trueturned on, which disables AOT builds and instead gives you a JIT build that does require the compiler at runtime. SetskipCodeGeneration: falseand that should give you an AOT build that doesn’t require the compiler.@sherlock1982 https://github.com/angular/angular-cli/issues/12646