nrwl / nx-labs

A collection of Nx plugins
MIT License
140 stars 51 forks source link

rspack in react app cannot resolve deep-imports from a monorepo library #349

Open Nick-Lucas opened 10 months ago

Nick-Lucas commented 10 months ago

A common pattern with Nx is to have a library with its imports not in the main index.ts, this is achieved just by adding a glob path to tsconfig.json

"paths": {
  "@org/lib": ["libs/lib/src/index.ts"],
  "@org/lib/*": ["libs/lib/src/*"]
}

When using rspack though, this seems to not work, as it can't resolve the import:

// works
import { a } from "@org/lib";

// FIXME: this import fails at build-time as unresolvable
import { bar } from "@org/lib/test-import";
image

Minimal reproduction here, it's just 1 app 1 lib and 1 deep import: https://github.com/Nick-Lucas/nx-spack-import-repro

VugarAhmadov commented 2 months ago

any solution for this?