Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
qvazzler opened this issue Oct 17, 2016 · 4 comments
Closed

Comments

@qvazzler
Copy link

qvazzler commented Oct 17, 2016

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

@qvazzler
Copy link
Author

qvazzler commented Oct 17, 2016

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

@Meligy
Copy link
Contributor

Meligy commented Oct 17, 2016

You might want to close the issue then ;)

@filipesilva
Copy link
Contributor

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

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants