-
-
Notifications
You must be signed in to change notification settings - Fork 783
Closed
Labels
Description
System Info
npmPackages:
@rspack/cli: 1.0.0-beta.5 => 1.0.0-beta.5
@rspack/core: 1.0.0-beta.5 => 1.0.0-beta.5
Details
When using resolve.extensionAlias, if one of the NPM package has a wrong package.json(e.g.: package.json#module set to a non exist path), Rspack failed to resolve the package without useful diagnostic message.
E.g.:
import { foo } from 'invalid-pkg'{
"name": "invalid-pkg",
"main": "./exist.js",
"module": "./non-exist.js"
}// rspack.config.js
const config = {
devtool: false,
entry: {
main: {
import: "./src/index.js",
},
},
resolve: {
mainFields: ['module', 'main'],
extensionAlias: {
'.js': ['.ts', '.js']
}
},
mode: "development",
}
export default configWhile webapck and esbuild will fallback to package.json#main, Rspack failed to resolve with error:
ERROR in ./src/index.js 1:0-31
× All of the aliased extension are not found
Rspack compiled with 1 error in 10 ms
Reproduce link
https://github.com/colinaaa/rspack-repro-resolve-extension-alias
Reproduce Steps
pnpm installnpm run build:rspack
The error will show up.
npm run build:webpack is fine.
Reactions are currently unavailable