Skip to content

Add proper exports when auto-import is turned off #288

@lukasaric

Description

@lukasaric

🆒 Your use case

If Nuxt project has autoImports turned off, when you want to import some composable from nuxt/scripts you need to do something like this:

import { useScriptGoogleTagManager } from '@nuxt/scripts/dist/runtime/registry/google-tag-manager'

Which also does not work and it leads to this error:

Image

🆕 The solution you'd like

Add Nuxt aliases or something similar so the developer can easily import composable or components explicitly.

Example:

// re-export everything through the root index barrel file
import { useScriptGoogleTagManager } from '@nuxt/scripts

// re-export just for certain folder index barrel file
import { useScriptGoogleTagManager } from '@nuxt/scripts/registry

// or avoid using barrel files due to performance issues and use at least Nuxt alias and directly import file
import useScriptGoogleTagManager from '@nuxt/scripts/registry/google-tag-manager.ts

🔍 Alternatives you've considered

No response

ℹ️ Additional info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions