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
Namespace object of reexported external star export #2165
Comments
Sounds good 👍 |
The better output here to match semantics is of course: import * as externalNs from 'external';
const ns = {
export: 'name'
};
for (let p in externalNs)
if (!(p in ns) && p !== 'default') ns[p] = externalNs[p]; Note that the |
Could you elaborate a little more in what way the previous approach is not spec compliant. In any case, the second approach would not require an |
|
Thx |
Just tested and |
See also #2489 |
🤞 |
@guybedford @lukastaegert thoughts on this one? Object.keys should be good to go in browsers since the OP date. |
This is very much a still-valid spec compliance bug. |
Agree. Just a note reading the above code, to my knowledge in case there is more than one namespace reexport, conflicting names should throw a specific error when accessed. Not sure if we would want to replicate this, though. |
At least at the moment we throw an error, which is better than outputting nonsense. |
Ah I missed that we now have an error here. This could be closed then I suppose. |
Or we fix it 😉 |
I'll add this to the middle-aged bug board |
This was resolved in PR #3474. |
Currently external star exports are not supported when reexported through namespace objects -
https://rollupjs.org/repl?version=0.58.2&shareable=JTdCJTIybW9kdWxlcyUyMiUzQSU1QiU3QiUyMm5hbWUlMjIlM0ElMjJtYWluLmpzJTIyJTJDJTIyY29kZSUyMiUzQSUyMmltcG9ydCUyMColMjBhcyUyMG0lMjBmcm9tJTIwJy4lMkZtYXRocy5qcyclM0IlNUNuJTVDbmNvbnNvbGUubG9nKG0pJTNCJTIyJTdEJTJDJTdCJTIybmFtZSUyMiUzQSUyMm1hdGhzLmpzJTIyJTJDJTIyY29kZSUyMiUzQSUyMmV4cG9ydCUyMColMjBmcm9tJTIwJ2V4dGVybmFsJyUzQiUyMiU3RCU1RCUyQyUyMm9wdGlvbnMlMjIlM0ElN0IlMjJmb3JtYXQlMjIlM0ElMjJjanMlMjIlMkMlMjJuYW1lJTIyJTNBJTIybXlCdW5kbGUlMjIlMkMlMjJnbG9iYWxzJTIyJTNBJTdCJTdEJTJDJTIyYW1kJTIyJTNBJTdCJTIyaWQlMjIlM0ElMjIlMjIlN0QlN0QlMkMlMjJleGFtcGxlJTIyJTNBbnVsbCU3RA==
I'd suggest we should output the following here instead:
effectively chaining Object.assign calls per reexported star exported module, in the precedence order, possibly with a final step to ignore the default export.
The text was updated successfully, but these errors were encountered: