Skip to content

Auto-import (composable) breaks when comments contain export default function #14971

@TheDutchCoder

Description

@TheDutchCoder

Environment


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

Reproduction

https://stackblitz.com/edit/github-1wqbue-7nfm99?file=composables/useMain.ts

const refMain = ref(null);

export default function useMain() {
  return {
    refMain,
  };
}

// export default function useMain() {
//   return {
//     refMain,
//   };
// }

Remove the comments, restart the server, and it will work again.

Describe the bug

This took me a while to find out, but if you have a composable that has comments that contain the default export, Nuxt will break and won't be able to auto-import the composable

Additional context

No response

Logs

No response

Metadata

Metadata

Assignees

Labels

3.xupstreamIssue caused by a dependency or upstream project🐛 bugSomething isn't working as expected🔨 p3-minorMinor issue, should be fixed

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions