Skip to content

Conversation

@Karibash
Copy link
Contributor

Summary

Add an option to prevent glob from ignoring directories starting with a dot.

Related Links

close #1195

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@Timeless0911
Copy link
Contributor

Thanks, can you add this case to tests tests/integration/bundle-false/basic?

@Timeless0911 Timeless0911 changed the title fix: Allow directories starting with a dot fix: should glob directories starting with a dot in bundleless mode Aug 28, 2025
@Karibash
Copy link
Contributor Author

It seems that when the file name contains a dot, an incorrect export is generated.
Does this require a fix in @rsbuild/core (or is it in @rspack/core instead)?

Actual behavior

export * from ".hiddenFile.js";

Expected behavior

export * from "./.hiddenFile.js";

@Timeless0911
Copy link
Contributor

Timeless0911 commented Aug 28, 2025

This require a fix here that the logic of determine whether it is a relative path

// Requests that fall through here cannot be matched by any other externals config ahead.
// Treat all these requests as relative import of source code. Node.js won't add the
// leading './' to the relative path resolved by `path.relative`. So add manually it here.
if (resolvedRequest[0] !== '.') {
resolvedRequest = `./${resolvedRequest}`;
}

I think we can modify like this:

if (
  !resolvedRequest.startsWith('./') &&
  !resolvedRequest.startsWith('../')
) {
  resolvedRequest = `./${resolvedRequest}`;
}

@Timeless0911
Copy link
Contributor

Can I submit to this pr?

@Karibash
Copy link
Contributor Author

Karibash commented Aug 28, 2025

Thanks a lot!
I had no idea which part of the logic was causing the issue, so your explanation really helped me.

Can I submit to this pr?

I think you’ll be able to submit it much faster than I could, so please go ahead and submit to the PR.

@Timeless0911 Timeless0911 changed the title fix: should glob directories starting with a dot in bundleless mode fix: should glob dot files in bundleless mode Aug 28, 2025
@Timeless0911 Timeless0911 requested a review from fi3ework August 28, 2025 09:04
@Timeless0911 Timeless0911 requested a review from fi3ework August 28, 2025 09:17
@fi3ework fi3ework merged commit a14f8d4 into web-infra-dev:main Aug 28, 2025
14 checks passed
@Karibash Karibash deleted the bugfix/hidden-directory branch August 28, 2025 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Hidden directories (starting with ".") are ignored when building in bundleless mode

3 participants