You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Essentially, a module is preloaded with the query string /module.js?id=123. If this is then later imported via user code, it's generally imported explicitly without the id param, ie import "module.js". This creates a new module identity, meaning /module.js?id=123 resolves as an entirely new module. This can cause problems modules containing side-effects.
When a module is preloaded, it should not create a new module identity.
As I understand there is already pre-processing of script happens? If so, appending id/hash - would be a sufficient path. As it would avoid a need of changing the caching logic for code.
Are import maps used?
Yep there is a pre-processing of scripts happening in a SW which maps module.js => module.js?id=123, however this was only being applied to requests originating from user scripts, ie. an explicit import X from module.js. The initial preload step would still load directly from module.js?id=123, meaning from the browsers perspective, these are 2 different url's.
I've submitted a patch which ensures the preload uses the same path as any explicit import paths within scripts.
Reporting this here from Discord
Essentially, a module is preloaded with the query string
/module.js?id=123
. If this is then later imported via user code, it's generally imported explicitly without theid
param, ieimport "module.js"
. This creates a new module identity, meaning/module.js?id=123
resolves as an entirely new module. This can cause problems modules containing side-effects.When a module is preloaded, it should not create a new module identity.
See repro here https://playcanvas.com/project/1280764/overview/import-test
The text was updated successfully, but these errors were encountered: