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

[Bug]: Compilation errors occur when using extensionAlias with package names ending in *.js #3557

Closed
Fitz6 opened this issue Sep 25, 2024 · 6 comments
Assignees
Labels
bug Something isn't working 🎯 upstream

Comments

@Fitz6
Copy link

Fitz6 commented Sep 25, 2024

Version

Browsers:
  Edge: Chromium (127.0.2651.74)
npmPackages:
  @rsbuild/core: 1.0.6 => 1.0.6

Details

In version 1.0.6, I noticed that the rspack.config.js generated by rsbuild includes an extensionAlias configuration.
If you install packageA, which has dependencies with package names ending in *.js, and packageA includes a node_modules folder, you'll encounter a compilation error.

 × All of the aliased extensions are not found for ....

You can reproduce it through the following steps:

# Choose the vanilla-ts template
npm create rsbuild@latest

npm install mathjs && mkdir node_modules/mathjs/node_modules
# or
pnpm install mathjs
// src/index.ts
import 'mathjs'
npm run build

Reproduce link

https://rsbuild.dev/guide/start/quick-start

Reproduce Steps

As mentioned above.

@chenjiahan
Copy link
Member

I still cannot reproduce this issue, but the edge case bugs seem to exist and I will revert the feature before we fix it.

@abenhamdine
Copy link

I also get the same error message with module @ant-design/pro-layout

@Fitz6
Copy link
Author

Fitz6 commented Sep 25, 2024

I still cannot reproduce this issue, but the edge case bugs seem to exist and I will revert the feature before we fix it.

Perhaps you missed some steps, such as not adding import 'mathjs' in src/index.ts, or there is no node_modules folder under the node_modules/mathjs directory.
I just tried it on both Linux and MacOS, and I can reproduce the same issue.

@Fitz6
Copy link
Author

Fitz6 commented Sep 25, 2024

I also get the same error message with module @ant-design/pro-layout

This is the same issue because @ant-design/pro-layout depends on omit.js.

@SoonIter
Copy link
Member

let me reproduce it and fix in rspack-resolver

@chenjiahan
Copy link
Member

Fixed by web-infra-dev/rspack-resolver#31

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 🎯 upstream
Projects
None yet
Development

No branches or pull requests

4 participants