Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This will PR generates the relative paths relationship for the JS bundles.
For instance, for the 2 exports which one is relying on the other one, and
./foo
is dependent on./
, project name is "my-lib":Bunchee will output the below structure and use
"<project name>/<export path>"
as dependency for each bundle to import the other export bundles. e.g. foo.js will import from"my-lib"
as it's the./
export.This output is not ideal cause it might resolve the 2nd module resolving. And some bundler might error (e.g. vite).
After this PR, the output the relative path for all imports and there's no extra module resolving. And we did some smart resolution which also based on the output format, to make sure CJS is only requiring other CJS bundles and ESM can resolve other ESM bundles.
e.g.
Types will also be smartly resolved like above, but since we could have
import.types
orrequire.types
conditions, or simplytypes
conditions, so we'll resolve twice to make sure it's able to be resolved properly matching with the format.Resolves #511