Comments (7)
I can accept a PR to allow to use hotUpdateGlobal: (chunk) => { return "myOwnName" + chunk.id }
from webpack.
ready #18672
from webpack.
Expected, you have multile runtimes on the same page, but the one HMR updating function, your patch doesn't fix the problem really, just workaround for your case (and will break HMR for another cases, when you split your chunks), please use optimization: { runtimeChunk: 'single' }
. When you have multiple chunks with own runtime on the same page, you always need to use runtimeChunk: 'single'
for HMR.
Feel free to feedback
from webpack.
Hey @alexander-akait , in our case the problem is that optimization: { runtimeChunk: 'single' }
doesn't fit the needs, so that's why I went for that approach. The idea is not that is mandatory or anything, is simply to have the ability to add something in case you have multiple runtimes in the same page (which can be very valid specifically in micro frontend architectures), and in that case having the ability to differentiate the runtimes.
For normal cases it would simply work as it has been working. The patch of course is just a workaround to validate that was the problem, but the idea is being able to maybe provide that way of differentiating the runtimes (even if they are in the same page), that's why I was proposing the usage of [name]
or [id]
as options that could be provided in output.hotUpdateGlobal
or maybe allowing the usage of a function in output.hotUpdateGlobal
that can receive the chunk.
Maybe it was wrong to open a bug because this might be more like asking for a feature instead?
Let me know what you think, thanks!
from webpack.
Using chunks ids is a bad idea and wrong here, not each chunk has runtime, technical we can allow to setup hotUpdateGlobal: "webpackHotUpdate[unique-name][runtime]"
and get the runtime
value from https://webpack.js.org/concepts/entry-points/#entrydescription-object
from webpack.
But there is a question about entries without runtime, which HMR functions they should be use...
from webpack.
I see, what can be done to maybe elaborate this a bit more? I would be happy to contribute, I simply lack a lot of the context and cases that need to be covered since webpack is quite a complex tool and covers many cases, but with a bit of guidance/requirements I would be happy to put together a proposal/poc or whatever you think is best, if you think we can try and move this forward of course 😄
Thank you!
from webpack.
Related Issues (20)
- Field 'browser' doesn't contain a valid alias configuration /opt/atlassian/pipelines/agent/build/src/css/index.css doesn't exist .tsx
- css not loaded properly?
- Webpack5 Angular SyntaxError: HookWebpackError: Module build failed
- Does CVE-2024-43788 actually affect Webpack 4? HOT 7
- EnvironmentPlugin types don't allow passing null HOT 1
- mangle destructuring default in dynamic import HOT 4
- Using aliases with dynamic imports in 5.94.0 HOT 1
- 对于rspack的出现 你们团队会因为这个竞品感到紧张吗 HOT 1
- SyntaxError: Unexpected token import on webpack build
- Webpack Stuck at 10% building forever HOT 2
- Compatibility with typescript 5.6 HOT 1
- Duplicated chunks do not merged after split chunks plugin finish work
- Dynamically importing the same file twice in a specific way, incorrectly processes the second request.
- Not able to resolve webpack loader issue
- Unable to build WebPack code in nodejs latest version HOT 1
- fatalDeprecations and verbose true not working on sass-loader HOT 1
- i am not able to start webpack live server on chrome for frontend changes can you help me how to start the server ? HOT 2
- webpack try to load arbitrary files when use variable parameter in dynamic import HOT 1
- Error during webpack plugin compilation with typescript 5.6.2 HOT 1
- Synchronous import of components exported by module federation?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webpack.