Repository navigation
fix(webpack): find ExternalModuleFactoryPlugin where webpack 5.112 moved it - #11633
Merged
Merged
Conversation
…ved it webpack 5.112 moved lib/ExternalModuleFactoryPlugin.js to lib/externals/, so loading NativeScriptBuiltinModulesPlugin threw "Cannot find module". Try the new location first and fall back to the old one, as the worker loader does for WorkerDependency.
|
View your CI Pipeline Execution ↗ for commit c1eceb0
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
commit: |
Contributor
|
@edusperoni I have confirmed this change fixes the problem in one of my apps. |
NathanWalker
approved these changes
Nov 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
What is the current behavior?
NativeScriptBuiltinModulesPlugin(#11626) loadswebpack/lib/ExternalModuleFactoryPlugin. webpack 5.112 moved that file towebpack/lib/externals/, so on current webpack the config fails to load withCannot find module 'webpack/lib/ExternalModuleFactoryPlugin'. This is the same kind of move #11547 fixed forWorkerDependency.What is the new behavior?
The plugin loads
webpack/lib/externals/ExternalModuleFactoryPluginand falls back to the old path, matching the worker loader's approach. The class's constructor andapply(normalModuleFactory)are unchanged between 5.99 and 5.112.Tested
__tests__/plugins/NativeScriptBuiltinModulesPlugin.spec.ts(real ESM and CommonJS compiles) against:CI only runs the repo's webpack version, so the 5.112 run was manual. The rest of the webpack suite is unchanged; its 14 failing snapshot tests also fail on
main.