Skip to content
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

Bundler generates incorrect import to current directory #6356

Open
cornedor opened this issue Oct 7, 2023 · 0 comments
Open

Bundler generates incorrect import to current directory #6356

cornedor opened this issue Oct 7, 2023 · 0 comments
Labels
bug Something isn't working bundler Something to do with the bundler

Comments

@cornedor
Copy link
Contributor

cornedor commented Oct 7, 2023

What version of Bun is running?

1.0.4+745b6b94ee56cad24d475799690cc9a89957d15b

What platform is your computer?

Darwin 23.0.0 arm64 arm

What steps can reproduce the bug?

See this repo: https://github.com/cornedor/bun-incorrect-imports

index.ts will bundle files from two directories using splitting: true. In build/client/Client.js you can see an invalid import.

What is the expected behavior?

Import to a file in the same directory looks like this:

import {
socket
} from "./Socket.js";

What do you see instead?

./ is missing from the import path.

import {
socket
} from "Socket.js";

Additional information

This only happens when that JS file also includes something from another directory.

This might be related to #5344, Socket.js also has a duplicate export.

When I remove the usage of the imported variable from the file, but keep the import, then this is generated:

import"Socket.js";

Note the missing space after import.

@cornedor cornedor added the bug Something isn't working label Oct 7, 2023
@cornedor cornedor changed the title Incomplete import when importing from current directory Bundler generates incorrect import to current directory Oct 7, 2023
@Electroid Electroid added the bundler Something to do with the bundler label Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working bundler Something to do with the bundler
Projects
None yet
Development

No branches or pull requests

2 participants