Skip to content

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

@Fitz6

Description

@Fitz6

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions