Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RC-8 composables auto-imports regression for /composables/<folder>/index.ts #14576

Closed
Kapcash opened this issue Aug 14, 2022 · 4 comments
Closed

Comments

@Kapcash
Copy link
Contributor

Kapcash commented Aug 14, 2022

Environment

(I ran this on stackblitz, but I reproduce on local with a more "complex" setup)

RootDir: /home/projects/github-cqsm6q-nwppro
Nuxt project info:


  • Operating System: Linux
  • Node Version: v16.14.2
  • Nuxt Version: 3.0.0-rc.8
  • Package Manager: npm@7.17.0
  • Builder: vite
  • User Config: css
  • Runtime Modules: -
  • Build Modules: -

Reproduction

  1. Creates a file following this path format: /composables/afolder/index.ts
  2. Export at least one member (variable, functions...)
  3. Use any exported member of this module in a nuxt page / plugin / component
    -> Nuxt will complain this doesn't exists, but it should be auto-imported.

The exported members of this file isn't present in the .nuxt/imports.d.ts nor .nuxt/auto-imports.d.ts.

https://stackblitz.com/edit/github-cqsm6q-nwppro?file=pages/index.vue

Describe the bug

The exported members of modules under /composables/<any-folder>/index.[jt]s are not auto-imported anymore.

Additional context

Replacing the nuxt dependency from 3.0.0-rc.8 to 3.0.0-rc.3 makes the project work as expected.

Logs

No response

@DamianGlowala
Copy link
Member

Have a look at the following PR introduced in the RC 7: nuxt/framework#6025

@HomWang
Copy link
Contributor

HomWang commented Aug 15, 2022

HomWang referenced this issue in HomWang/framework Aug 15, 2022
@HomWang
Copy link
Contributor

HomWang commented Aug 15, 2022

in nuxt.config.ts add

import { defineNuxtConfig } from 'nuxt';

export default defineNuxtConfig({
  css: ['~/assets/main.css'],
  autoImports: {
    dirs: [
      'composables', // top-level modules
      'composables/*/index.{ts,js,mjs,mts}', // one level directories's index.js,
      //'composables/**', // Scan all nested directories
    ],
  },
});

@Kapcash
Copy link
Contributor Author

Kapcash commented Aug 15, 2022

Thank you! I missed the changed on the documentation / migration guide indeed.
I just updated my nuxt.config and it's working fine :)

@Kapcash Kapcash closed this as completed Aug 15, 2022
@danielroe danielroe added the 3.x label Jan 19, 2023
@danielroe danielroe transferred this issue from nuxt/framework Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants