I am encountering a problem with a Next.js project set up using nx and VS Code:
When trying to automatically import a component in VS Code, it generates an absolute import which then triggers the
@nrwl/nx/enforce-module-boundaries
eslint rule, rendering the current file as invalid.
For example, consider the following folder structure:
apps/my-app/
pages/
entity/
new/
index.tsx
components/
Loading.tsx
The generated import looks like this:
// in my-app/pages/entity/new/index.tsx
import Loading from 'apps/my-app/components/Loading'
However, I expect it to be:
import Loading from '../../../components/Loading'
Although VS Code has a setting to always use relative paths for imports, it may prevent importing libraries in the appropriate manner (@scope/lib
).
Is there any configuration that can ensure auto imports function as expected?