Skip to content

fix: Export 'useState' from 'nuxt/app' instead of '#imports' #782

Open
@guaijie

Description

🐛 The bug

Image

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  compatibilityDate: '2025-02-07',
  hooks: {
    'imports:sources'(presets) {
      const index = presets.findIndex(
        (preset) => preset.from === '#app/composables/state'
      );
      presets.splice(index, 1);
    },
  },
});

As you can see from the configuration file, I removed 'useState' from autoImports.
This is normal behavior because developers can choose which modules to remove from autoImports.
So you shouldn't import modules from '#imports' anyway.

🛠️ To reproduce

https://stackblitz.com/edit/github-vrre2hcu?file=nuxt.config.ts

🌈 Expected behavior

no response

ℹ️ Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions