-
-
Notifications
You must be signed in to change notification settings - Fork 42
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
Support for auto renaming nodes with the same name in the bundle #116
Comments
I just renamed my variables and the bundle is constructed properly, but the exported names are still wrong. Input code // template1.ts
const TEMPLATE$1 = "template1";
export default TEMPLATE$1; // template2.ts
const TEMPLATE$2 = "template2";
export default TEMPLATE$2; // index.ts
export {default as TEMPLATE1} from "./template1";
export {default as TEMPLATE2} from "./template2"; Actual output: // Generated by dts-bundle-generator v4.3.0
export declare const TEMPLATE$1 = "TEMPLATE1"
export declare const TEMPLATE$2 = "TEMPLATE2"
export {}; |
It looks like the second limitation, isn't it? I'll check what we can do here, but for now you can use workaround: // index.ts
import TEMPLATE1 from "./template1";
import TEMPLATE2 from "./template2";
export { TEMPLATE1, TEMPLATE2 }; (and the same names in template files) |
Maybe I misunderstood the 2nd limitation, but I thought that only applies when re-exporting a default export as a default export. The workaround worked though, and it actually still works, even if both variables are named |
Yeah, I've thought it is so 😂 Looks like the issue is with default exports in common. From the beginning It might be I can (easily) fix the issue from #116 (comment) in the way: declare const TEMPLATE$1 = "TEMPLATE1";
declare const TEMPLATE$2 = "TEMPLATE2";
export { TEMPLATE$1 as TEMPLATE1, TEMPLATE$2 as TEMPLATE2 };
export {}; but I can't tell you for sure. |
The fix has been released in v9.0.0. |
Bug report
Input code
Expected output
or
Actual output
Console output:
Additional context
Add any other context about the problem here (CLI options, etc)
dts-bundle-generator
will throw errors when you use the same variable name more than once. This is presumably, because the script only concatenates the files and does not perform an analysis of name collisions.However, the API surface of the module is also incorrect, because the wrong names are exported. I'm not sure if this is just due to the name clash or because of an underlying issue.
I'm using
dts-bundle-generator 4.3.0
andtypescript 3.8.3
.The text was updated successfully, but these errors were encountered: