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

Support Angular v10 #781

Closed
qortex opened this issue Jun 25, 2020 · 26 comments · Fixed by #782
Closed

Support Angular v10 #781

qortex opened this issue Jun 25, 2020 · 26 comments · Fixed by #782

Comments

@qortex
Copy link

qortex commented Jun 25, 2020

After migrating to Angular v10:

warning "@angular-builders/custom-webpack > @angular-devkit/build-angular@0.901.1" has incorrect peer dependency "@angular/compiler-cli@>=9.0.0 < 10".
warning "@angular-builders/custom-webpack > @angular-devkit/build-angular@0.901.1" has incorrect peer dependency "typescript@>=3.6 < 3.9".
warning "@angular-builders/custom-webpack > @angular-devkit/build-angular > @ngtools/webpack@9.1.1" has incorrect peer dependency "@angular/compiler-cli@>=9.0.0 < 10".
warning "@angular-builders/custom-webpack > @angular-devkit/build-angular > @ngtools/webpack@9.1.1" has incorrect peer dependency "typescript@>=3.6 < 3.9".
@KrakenTyio
Copy link

Main issue is @ngtools/webpack should use parent project @ngtools/webpack deps when is present

I upgrade all my deps to ~10
but custom-webpack use his own old ~9 and raise *.ngtypecheck.ts warning for typechecking

quickfix for users
after npm remove node_modules/@angular-builders/custom-webpack/node_modules/@ngtools dir and also @angular-devkit then set it to your own package.json and devdeps

@qortex
Copy link
Author

qortex commented Jun 25, 2020

Ah! I am indeed hitting the *.ngtypecheck.ts warnings :(
Thanks for making it clear.

So are you saying that the warnings will disappear when package updates to Angular v10?

@KrakenTyio
Copy link

@qortex yes, this poackage has not hitted deps from parrent so its create his local node_modules targeting verzion ~9

i put to my package.json temporary

"postinstall": "cd node_modules/@angular-builders/custom-webpack/node_modules && rm -rf @ngtools && rm -rf @angular-devkit"
.....
devDeps:
"@angular-devkit/build-angular": "~0.1000.0",
"@ngtools/webpack": "~10.0.0",

and app work well

tested on big app with 400chunks

@qortex
Copy link
Author

qortex commented Jun 25, 2020

Ok I see, thanks.

So I guess the fix would involve updating this file to new dependencies: https://github.com/just-jeb/angular-builders/blob/master/packages/custom-webpack/package.json

@qortex
Copy link
Author

qortex commented Jun 25, 2020

Ho but I see it's already on the way: #782
Thanks @just-jeb !

@just-jeb
Copy link
Owner

You guys are fast

@just-jeb just-jeb mentioned this issue Jun 25, 2020
2 tasks
@just-jeb
Copy link
Owner

You're welcome to try the latest beta 10.0.0-beta.0 and let me now if there are any issues in migration.

@qortex
Copy link
Author

qortex commented Jun 25, 2020

I confirm it works fine in my setup. Thanks for the very quick patch!

@KrakenTyio
Copy link

work like a charm

@piotrroda
Copy link

After update to 10.0.0-beta.0 I see an error:

An unhandled exception occurred: Cannot find module 'webpack'
Require stack:
- C:\SLS_EB\Claims\Angular\node_modules\webpack-dev-server\lib\Server.js
- C:\SLS_EB\Claims\Angular\node_modules\@angular-devkit\build-angular\node_modules\@angular-devkit\build-webpack\src\webpack-dev-server\index.js
- C:\SLS_EB\Claims\Angular\node_modules\@angular-devkit\build-angular\node_modules\@angular-devkit\build-webpack\src\index.js
- C:\SLS_EB\Claims\Angular\node_modules\@angular-devkit\build-angular\src\browser\index.js
- C:\SLS_EB\Claims\Angular\node_modules\@angular-devkit\build-angular\src\index.js
- C:\SLS_EB\Claims\Angular\node_modules\@angular-builders\custom-webpack\dist\browser\index.js
- C:\SLS_EB\Claims\Angular\node_modules\@angular\cli\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js
- C:\SLS_EB\Claims\Angular\node_modules\@angular\cli\node_modules\@angular-devkit\architect\node\index.js
- C:\SLS_EB\Claims\Angular\node_modules\@angular\cli\models\architect-command.js
- C:\SLS_EB\Claims\Angular\node_modules\@angular\cli\commands\build-impl.js
- C:\SLS_EB\Claims\Angular\node_modules\@angular-devkit\schematics\tools\export-ref.js
- C:\SLS_EB\Claims\Angular\node_modules\@angular-devkit\schematics\tools\index.js
- C:\SLS_EB\Claims\Angular\node_modules\@angular\cli\utilities\json-schema.js
- C:\SLS_EB\Claims\Angular\node_modules\@angular\cli\models\command-runner.js
- C:\SLS_EB\Claims\Angular\node_modules\@angular\cli\lib\cli\index.js
- C:\SLS_EB\Claims\Angular\node_modules\@angular\cli\lib\init.js
- C:\SLS_EB\Claims\Angular\node_modules\@angular\cli\bin\ng

@lhargil
Copy link

lhargil commented Jun 25, 2020

You're welcome to try the latest beta 10.0.0-beta.0 and let me now if there are any issues in migration.

I encountered a Cannot find module webpack after rebuilding my app using the beta version. A quick npm link webpack command fixed it.

I confirm that the fix specified in the beta works to address the warnings.

Thank you very much ! :)

@qortex
Copy link
Author

qortex commented Jun 26, 2020

But now my Heroku builds don't pass anymore :(
That's weird since they pass fine on my machine with the same arguments. I get:

-----> Build
       Running build (yarn)
       yarn run v1.22.4
       $ ng build -c=$ENV_PIPELINE --aot --build-optimizer --optimization --verbose
    WARNING: Zone.js does not support native async/await in ES2017.
    These blocks are not intercepted by zone.js and will not triggering change detection.
    See: https://github.com/angular/zone.js/pull/1140 for more information.
[...]
Compiling ngx-webstorage-service : es2015 as esm2015

and then nothing, and it times out.
I can't get more info it seems.

Any idea why that would be happening, or a way to debug?

@just-jeb
Copy link
Owner

@piotrroda did you try clean install? Removing node modules and etc.? @lhargil same question.
@qortex tbh no idea. Maybe you have something cached on build agent? Can you reproduce this error without custom-webpack? Sounds like Angular issue.

@lhargil
Copy link

lhargil commented Jun 27, 2020

@piotrroda did you try clean install? Removing node modules and etc.? @lhargil same question.

Yes i did a clean install after updating to the beta. As mentioned, the npm link webpack command solved the Cannot find module 'webpack' :)

@KrakenTyio
Copy link

Also can confirm on my CI, with beta deps halting with "cannot find module webpack" as is mention above

@just-jeb
Copy link
Owner

just-jeb commented Jun 28, 2020

Do you have package-lock.json/yarn.lock? If yes, try removing it and regenerating.

@inpercima
Copy link

inpercima commented Jun 28, 2020

I had the same problem but I can confirm with version 10.0.0-beta.0 the warning problem is fixed. Thanks. 👍

@qortex
Copy link
Author

qortex commented Jun 29, 2020

Turns out it's an "out-of-memory" on my heroku builder.
I'll look into debugging it, don't know if it's related to angular-builders or not. (Hard for me to disable angular-builders since I use to compile *.graphql files).

@qortex
Copy link
Author

qortex commented Jul 1, 2020

Alright, the memory issue turned out to be a (very much!) non-trivial bug in copy-webpack-plugin. It is tracked here: angular/angular-cli#18087 (comment)

It appears only if differential loading is disabled ans was actually already there in v9.

A patch will be released upstream.

Note: during the investigation, the Angular team member saw that my builds involve what seems to be a lot of webpack compilations (121). Any tip on if it's normal or due to a misconfig of angular-builders on my part would be appreaciated :)

@danmana
Copy link

danmana commented Jul 1, 2020

I had the same issue with Cannot find module webpack after upgrading.
I didn't want to run npm link webpack especially on the build server.

What I ended up doing (and worked) was:

npm uninstall --save-dev @angular-builders/custom-webpack
rm -rf package-lock.json
rm -rf node_modules
rm -rf dist # this seems to be important for some reason, I tried the same steps without this before and it didn't work ...
npm install
npm install --save-dev @angular-builders/custom-webpack@10.0.0-beta.0

I can't say for sure this will work on the first try, as I did some of the steps multiple times, but eventually, it worked without npm link.

@benelliott
Copy link

Inspired by @danmana's message, wiping node_modules and package-lock.json then running npm i was enough to fix the webpack resolution error for me.

@rweng
Copy link

rweng commented Jul 10, 2020

I needed to update to "@angular-devkit/build-angular": "~0.1000.0",. Also regenerated package-lock.json.

@hudzenko
Copy link

Any news about v10 stable release?

@just-jeb
Copy link
Owner

Just published.

@lhargil
Copy link

lhargil commented Jul 21, 2020

Just published.

Thank you @just-jeb ! :)

@zuzusik
Copy link

zuzusik commented Oct 23, 2020

To Cannot find module webpack issue.

The alternative solution which worked for me was uninstalling @angular-builders/custom-webpack prior to upgrading to Angular 10 and then after upgrading to Angular 10 - installing it again.

Note: Removing package-lock.json as suggested above might be quite a bold move as that would implicitly update application dependencies to the latest versions allowed by package.json, where the whole purpose of package-lock.json is to avoid such implicit updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.