-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
runtime.js cannot find bundles to require when code splitting among multiple bundles is enabled #18409
Comments
Do you build application or library? What is your target - |
My target is node. |
Why do you need |
Yeah, it is a bug, something wrong with Feel free to send a fix |
We are developing a server architecture where you have a "core bundle" (where the actual entry point of the application is) and several "client" ones, and we want to be able to split this code so that we can deploy the application with zero, one or just a few client bundles instead of all of them. The rationale is twofold:
|
Got it, feel free to send a fix |
Bug report
I have encountered a bug while trying to split code into multiple bundles, while preventing
duplication of said code. In other words, I want to create a "main" bundle which is the "true"
entry point of the application, and one or more auxiliary bundles. To this end, I have followed
the documentation present at this page.
What is the current behavior?
The following is the config object contained in my
webpack.config.js
file:After launching the
npx webpack
command and executingnode .\dist\main.js
, node throws the followingError
:If the current behavior is a bug, please provide the steps to reproduce.
I have written a simple test project that is available at this GitHub repository.
After downloading the project simply run
npm run dev
to get the required node_modules(webpack, webpack-cli and their dependencies) and then automatically execute
node .\dist\main.js
.What is the expected behavior?
It seems that
.\dist\runtime.js
is broken, specifically in two points.Why is this function returning
undefined
regardless of thechunkId
being passed?In development mode, if I change the return line into
the
require()
that is immediately called after, is working.Another issue I've identified, lies within this function:
Sometimes the
chunk
argument being passed is an empty object{}
, thereforechunkIds
isundefined
.In this case when the for loop is reached, accessing
chunkIds.length
results in anError
being thrown.Other relevant information:
webpack version: 5.91.0
Node.js version: v18.18.0
Operating System: Windows 10 Enterprise 22H2
Additional tools: none
The text was updated successfully, but these errors were encountered: