Skip to content

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

Closed

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..

Activity

  1. qvazzler commented on Oct 17, 2016

    @qvazzler
    Author

    Ok, it turns out, that copy-webpack-plugin is mostly to blame for the extreme increase in asset optimization.

    I removed it, and now it's pretty much instant..

  2. Meligy commented on Oct 17, 2016

    @Meligy
    Contributor

    You might want to close the issue then ;)

  3. filipesilva commented on Oct 17, 2016

    @filipesilva
    Contributor

    @qvazzler we also removed it in #2570 for a similar reason, it was affecting some users.

  4. angular-automatic-lock-bot commented on Sep 6, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  5. locked and limited conversation to collaborators on Sep 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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