bridge
bridge copied to clipboard
TypeError for bridge:{autoImports} in nuxt.config.ts
Environment
- Operating System:
Darwin - Node Version:
v16.15.0 - Nuxt Version:
2.16.0-27616340.013f051b - Package Manager:
[email protected] - Builder:
webpack - User Config:
srcDir,bridge,ssr,dev,webpackOptimisations,alias,image,generate,head,typescript,publicRuntimeConfig,privateRuntimeConfig,css,loading,loadingIndicator,plugins,components,buildModules,modules,proxy,axios,vuetify,build,serverHandlers,devServerHandlers - Runtime Modules:
@nuxtjs/[email protected],@nuxt/[email protected],@nuxtjs/[email protected],@nuxtjs/[email protected],[email protected] - Build Modules:
(),[email protected],[email protected],[email protected],@pinia/[email protected],@nuxt/[email protected]
Reproduction
Add this to nuxt.config.ts
bridge: {
autoImports: {
dirs: [
// Scan composables from nested directories
'composables/**',
],
},
},
Describe the bug
Additional context
No response
Logs
No response
You can set autoimports only false or true.
@antlionguard
is this only applicable for nuxt 3?

@antlionguard is this only applicable for nuxt 3?
No but you using wrong. You need to put directly inside the defineConfig not the bridge object.
@antlionguard Thank you for pointing it out. I am trying it out now. I would suggest however to group all autoImport related to that object.
so instead of
// Auto import components (https://go.nuxtjs.dev/config-components)
components: true,
we can maybe do it like
autoImports: {
components: true,
composables:{
dirs: [
// Scan composables from nested directories
'composables/**',
]
}
},
@antlionguard Thank you for pointing it out. It works like a charm. I would suggest however to group all autoImport related to that object.
so instead of
// Auto import components (https://go.nuxtjs.dev/config-components) components: true,we can maybe do it like
autoImports: { components: true, composables:{ dirs: [ // Scan composables from nested directories 'composables/**', ] } },
I think it might too. You should open new discussion for this suggestion and you feel free closing this issue.
@antlionguard I'm sorry,
i thought it was working

This problem should have been resolved with #145 but i guess it still is. @danielroe
Ah, yes. This was an upstream change in unimport. Please see this migration guide. It is for Nuxt 3 but applies in this case.
@danielroe

for non named exports(default) should i do it like export { default as useToast } from './utils/useToast'
To be clear, bridge.imports (we've recently renamed it) should be set to true/false. Configuration is provided in a top-level imports key.