Environment
- unbuild@3.6.0
- typescript@5.8.3
- node@v22.17.1
Reproduction
- Open StackBlitz
- Run
npx unbuild
- Inspect the output files:
-
dist/common/fn.js (all correctly transformed)
-
dist/runtime/fn.js (import from src/common/ wasn't transformed)
Describe the bug
mkdist has built-in functionality for resolving relative imports, and it works great. You can see this in the dist/common/fn.js file.
import { COMMON_CONFIG } from "./config/index.js"; // correctly transformed
export const getConfig = () => {
return COMMON_CONFIG;
};
Unfortunately, this functionality doesn't work when multiple entries are specified. This is evident in the dist/runtime/fn.js file. In that file, the import from src/runtime/ is correctly transformed, but the import from src/common/ remains unchanged.
import { COMMON_CONFIG } from "../common/config"; // wasn't transformed
import { RUNTIME_CONFIG } from "./config/index.js"; // correctly transformed
export const getCommonConfig = () => {
return COMMON_CONFIG;
};
export const getRuntimeConfig = () => {
return RUNTIME_CONFIG;
};
Is there a way to configure unbuild so that it properly resolves extensions when using multiple entries?
Additional context
No response
Logs
Environment
Reproduction
npx unbuilddist/common/fn.js(all correctly transformed)dist/runtime/fn.js(import fromsrc/common/wasn't transformed)Describe the bug
mkdist has built-in functionality for resolving relative imports, and it works great. You can see this in the
dist/common/fn.jsfile.Unfortunately, this functionality doesn't work when multiple
entriesare specified. This is evident in thedist/runtime/fn.jsfile. In that file, the import fromsrc/runtime/is correctly transformed, but the import fromsrc/common/remains unchanged.Is there a way to configure
unbuildso that it properly resolves extensions when using multipleentries?Additional context
No response
Logs