-
Notifications
You must be signed in to change notification settings - Fork 27
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
Assignments to exported variables are not visible in other modules #38
Comments
Because the iitm wrappers assign each export to a variable before re-exporting, primitive exports have their original value copied and the reference is lost. This is where the code generation does that: Lines 189 to 190 in 57d2459
Possible solutions/workarounds? I dont think there's much we can actually do to fix this. |
@timfish I encountered this issue when working with a SvelteKit application. I was trying to update our NewRelic Node.js agent to a more recent version; NewRelic switched to using When I was testing that setup with the SvelteKit app, this turned out to be a blocking bug because of this module in SvelteKit that relies on reassigning exported symbols, like my simplified repro above. With that said, I am no longer working on that project so this is no longer important to me personally, but I expect that this issue could affect other users of |
Expected Behavior
If a module exports a variable that was defined with
let
and can be reassigned, other modules that import that variable should always see the current value of the variable.E.g.
env.js:
If module1 calls
setEnv
with a new value, and module2 referencesenv
, module2 should see the new value.Actual Behavior
With the Node flag
--experimental-loader=import-in-the-middle/hook.mjs
, module2 actually sees the old value.Steps to Reproduce the Problem
I made a repro here: https://github.com/dennisjlee/iitm-assign-module-var-repro
Specifications
The text was updated successfully, but these errors were encountered: