-
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
6.0.0 build fails with lazy modules and Node API #10698
Comments
I'm running into this issue as well. @Enngage did you have a workaround for now? |
@Shak3y I don't unfortunately. It seems like Angular/WebPack is doing static analysis and is resolving require in whatever condition it is under. |
@Enngage any updates? Today I saw same issue in my project. But it become happens only after trying to switch on yarn workspaces. Maybe it can be a clue |
Seems like this is bug in angular-cli.. Would love to see this resolved. As a workaround we have created a separated package with webpack where we excluded files with node dependency (they are not in project = there is no problem). If you are using external libraries that have this problem, you are in troubles. |
We have indeed removed the native node APIs in v6. You can find more information about this in #9827 (comment). |
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. |
Versions
Observed behavior
We have application that lazy loads module that depends on
node
Api and is included only if process is running under node using:We confirmed that this branch is not hit when building the Angular application and its also not hit when running
ng serve
. For some reasons, however, the builder seems to be attempting to resolve the module anyway. Because of that we get this error during compilation:Sure, we could use
parse5
on version 4 (which does have 'sort of' workaround for running under node), but then we get a warning message like:We know we can skip this in webpack.config (and we did), but it seems to not be relevant to the issue I'm raising. I would expect that lazy modules would not be resolved during compilation. They can fail during runtime, thats fine (though it should not happen because we include different modules in different environments).
This worked perfectly fine with
angular/[email protected]
Desired behavior
Don't resolve lazy loaded modules with
require
when building an app because these modules might contain API that does not exist in given environment.The text was updated successfully, but these errors were encountered: