NuxtN
Nuxt6mo ago
3 replies
8ctavio

`#components` conflict when auto-importing components from an external package

Hi, I'm trying to write a simple nuxt module to add auto import support for a package's exported components. However, the external package uses the
#components
import mapping internally, and it seems to conflict with nuxt's
#components
.

Here is a demo; it uses pnpm's workspaces to install a local
pkg
package as a dependency for the nuxt project. The module simply adds a component from
pkg
with
addComponent
, and the
pkg
's package.json uses the
#components
import mapping.

Running
pnpm dev
yields

Error: [unimport] failed to find "Private" imported from "#components"


If
#components
is changed to something else in the
pkg/Public.vue
and
pkg/package.json
files, the component is correctly registered by the module.

Is there a way to prevent this conflict without having to update the external package's
#components
import mapping?
StackBlitz
Create a new Nuxt project, module, layer or start from a theme with our collection of starters.
#components conflict - StackBlitz
Was this page helpful?