-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Problems with import * as foo...
#174
Comments
Thanks for the report. Correctness issues like this are my top priority and I really want to fix this. I believe someone else was hitting this too in #147. However, I'm unable to reproduce the issue based on your description. Here's what I get when I try this: (() => {
let __defineProperty = Object.defineProperty;
let __markAsModule = (target) => {
return __defineProperty(target, "__esModule", {value: true});
};
let __export = (target, all) => {
__markAsModule(target);
for (let name in all)
__defineProperty(target, name, {get: all[name], enumerable: true});
};
// ../modules/foo/mutations.js
const mutations_exports = {};
__export(mutations_exports, {
foo: () => foo
});
let foo = 123;
// ../modules/bar/mutations.js
const mutations_exports2 = {};
__export(mutations_exports2, {
bar: () => bar
});
let bar = 123;
// example.js
console.log(mutations_exports, mutations_exports2);
})(); My source files:
Can you provide a code sample that reproduces the issue? |
Thanks for getting back to me so quickly. Here is a reproducible example: https://github.com/eigilsagafos/esbuild-import-bug |
Thanks for the test case. Looks like you need to use the CommonJS output format to reproduce it. The bug was that export object renaming should only be prevented for the entry point file, not for all files. This should be fixed in version 0.4.13. |
I just spent some time testing esbuild in a pretty large graphql node project. I'm able to make it build at an amazing speed 🚀 however I'm having issues with duplicate declarations in the output. The issue seems to be that when using
import * as moduleName
they are named by the filename and prefixed _exports in the output resulting in duplicate declarations if you have multiple files with the same name.So this:
becomes this:
The end result is multiple
const mutations_exports
declarations.The text was updated successfully, but these errors were encountered: