Skip to content

AoTPlugin (webpack + watch) takes over 2 minutes to do asset optimization #2746

Closed
@qvazzler

Description

@qvazzler

OS?

Windows 8.1

Versions.

v6.5.0

Parts of package.json

"@angular/common": "^2.0.2",
"@angular/compiler": "^2.0.2",
"@angular/compiler-cli": "^2.1.0",
"@angular/core": "^2.0.2",
"@angular/platform-browser": "^2.0.2",
"@angular/platform-browser-dynamic": "^2.0.2",
"@angular/platform-server": "^2.0.2",
"@ngtools/webpack": "^1.1.0",
"@types/chrome": "0.0.35",
"@types/core-js": "^0.9.34",
"@types/filesystem": "0.0.28",
"@types/jquery": "^2.0.33",
"@types/node": "^6.0.45",
"@types/requirejs": "^2.1.28",
"angular-cli": "^1.0.0-beta.17",
"angular2-router-loader": "^0.3.2",
"angular2-template-compiler": "^0.1.9",
"angular2-template-loader": "^0.5.0",
...
"webpack": "^2.1.0-beta.25",
"webpack-manifest-plugin": "^1.0.1",
"webpack-notifier": "^1.4.1",
"webpack-shell-plugin": "^0.4.3",
"webpack-vendor-chunk-plugin": "^1.0.0",

Repro steps.

It's a chrome extension that I created from scratch. It utilized Webpack 1.x at first, then onto Webpack 2.x. It uses TypeScript 2.x.

Basically I am just copying the files from the blacksonic angular2-aot-webpack repo..

His repo still uses ngtools.NgcWebpackPlugin and not AoTPlugin.

He also doesn't use @ngtools/webpack it seems.

        test: /\.ts$/,
        use: [
          'awesome-typescript?tsconfig=tsconfig.json',
          'angular2-template'
        ]

I am using this:

                {
                    test: /\.ts$/,
                    //exclude: [ /.*\.ngfactory\..*/ ],
                    use: ["@ngtools/webpack"]
                },

The log given by the failure.

Using the following

            new ngtools.AotPlugin({
                tsConfigPath: './tsconfig.aot.json',
                baseDir: path.resolve(__dirname, ''),
                entryModule: path.join(__dirname, 'app', 'www', 'starter', 'app', 'main') + '#MainModule'
            }),

Builds quickly (less than 5 seconds), but as soon as it finishes building, the watch mode in webpack triggers a recompile, where the below step is taking an incredibly long time the first time. Once this one is done, all the next recompiles are super-quick.

147198ms [0] asset optimization
19574ms [0] emitting

Mention any other details that might be useful.

This is the speed when commenting out the AoTPlugin:

488ms [0] chunk asset optimization
64ms [0] asset optimization
20ms [0] emitting

I have tried to reduce overhead of stuff in my config, but in the end we're talking like 5-10 entries, and barely any plugins..

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions