-
Notifications
You must be signed in to change notification settings - Fork 12k
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
TypeError: The 'compilation' argument must be an instance of Compilation #20773
Comments
Can you please provide the output of Thanks. |
|
with terser being a dep of webpack AND having webpack as a dependency, I do not think it can be avoided. |
Install terser directly
|
@zehavibarak thank you for your attempt to help. can you explain a bit what do you think the issue is and how this will solve it? |
You have more than one webpack version. Install latest terser and make sure to install webpack of a version that matches the inner version.
|
bash
and verify webpack is of 5.37 |
Webpack is a direct dependency of Probably, something went wrong during module hoisting, can you please try the below;
NB: please revert any changes suggested above by @zehavibarak. This will most certainly cause your project to be in a broken state. |
It may align all versions, worth at least a try. There is that other bug you avoid. The one you closed without resolving
|
I am having this issue as well. The webpack version alignment didn't work. I'll try the below to see if that helps: rm -rf node_modules package-lock.json |
@careywalker share your npm ls webpack |
This isn't an issue for me anymore. What I did:
Once I did the above, I no longer get the error on ng build. |
The error happens when there are 2 versions of webpack in the dependency tree. eg webpack@5.37.0 and webpack@5.36.2. There are no safeguards for this problem.
This will force webpack@5.36.2 to be deduped at the root of the project. To workaround the problem:
|
If |
Using npm 7.13.0. Additional peer dependencies would prevent a broken tree:
|
I had a fairly similar issue, though I think not exactly the same. It is probably closer to #20786 which is marked a duplicate of this issue, so I still posted here. In contrast to this issue I use npm 6.14.3. I use an nx workspace with angular, nestjs and storybook. When upgrading angular the app did not serve anymore throwing the following error
npm ls webpack resulted in
The upgarde left webpack at version 4 in the node_modules folder. I deleted the node_modules folder and package-lock.json and made a fresh npm install and it worked again. npm ls webpack now reports
It seems as if the dependencies of webpack for angular and @nrwl/node are met, while the storybook dependency is not met. |
I have the same issue, when I use
When I use |
I was having this same issue in my nx workspace and finally figured it out. I was hoping that nx would handle upgrading/removing the webpack dependencies, but it did not. Coming from previous version of angular, we've had webpack as a direct dev dependency inside of our package.json.
I read in another issue (#20786 (comment)) that webpack doesn't need to be installed directly, because it's a dependency of the Steps that fixed it for me:
|
Closing as this doesn't appear to be caused by the Angular CLI. |
I was experiencing the same error. While we use webpack directly for some projects in our monorepo (so can't/shouldn't remove the explicit webpack dependency), we had a "resolutions": {
"webpack": "^5.0.0"
}, Thanks to the pointers from @alan-agius4 and others, I found that removing this block, and deleting |
…12.0.4+ @angular-devkit/build-angular 12.0.4+ makes build-storybook hang. Constraining it to 12.0.3 avoids the hang. Upstream issue, and workaround: storybookjs/storybook#15227 (comment) Also jump through some hoops to downgrade webpack from 5.39.1 to 5.38.1, to match the exact dependency expected by @angular-devkit/build-angular, and avoid this problem: angular/angular-cli#20773
…12.0.4+ @angular-devkit/build-angular 12.0.4+ makes build-storybook hang. Constraining it to 12.0.3 avoids the hang. Upstream issue, and workaround: storybookjs/storybook#15227 (comment) Also jump through some hoops to downgrade webpack from 5.39.1 to 5.38.1, to match the exact dependency expected by @angular-devkit/build-angular, and avoid this problem: angular/angular-cli#20773
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Upgrading from angular 11.2 to angular 12 and trying ng build / ng serve causes this error.
Is this a regression?
yes. Used to build in previous version.
Description
A clear and concise description of the problem...Minimal Reproduction
https://stackblitz.com/...Exception or Error
Your Environment
Angular Version:
Anything else relevant?
The text was updated successfully, but these errors were encountered: