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 config
While 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 install
npm run build:rspack
The error will show up.
npm run build:webpack is fine.
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 wrongpackage.json(e.g.:package.json#moduleset to a non exist path), Rspack failed to resolve the package without useful diagnostic message.E.g.:
{ "name": "invalid-pkg", "main": "./exist.js", "module": "./non-exist.js" }While webapck and esbuild will fallback to
package.json#main, Rspack failed to resolve with error:Reproduce link
https://github.com/colinaaa/rspack-repro-resolve-extension-alias
Reproduce Steps
pnpm installnpm run build:rspackThe error will show up.
npm run build:webpackis fine.