Autoimport components dir
See original GitHub issueEnvironment
- Operating System:
Linux
- Node Version:
v17.6.0
- Nuxt Version:
3.0.0-27458584.91fd16a
- Package Manager:
yarn@1.22.18
- Builder:
vite
- User Config:
privateRuntimeConfig
,app
,components
,nitro
,srcDir
,build
,buildModules
,modern
,tailwindcss
,meta
- Runtime Modules:
-
- Build Modules:
@nuxtjs/tailwindcss@5.0.2
Reproduction
–
Describe the bug
when i trying to start my project with new version of nuxt 3 i have error:
[Vue warn]: Failed to resolve component: NavLink If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement. Invalid value used as weak map key
my nuxt.config.ts
:
import { defineNuxtConfig } from 'nuxt3';
export default defineNuxtConfig({
privateRuntimeConfig: {
secretJWT: process.env.SECRET_JWT,
},
app: {
buildAssetsDir: 'assets/',
},
components: {
global: true,
dirs: ['~/components'],
},
nitro: {
output: {
dir: 'build',
},
externals: {
inline: ['uuid'],
},
},
srcDir: 'src',
build: {
splitChunks: {
pages: true,
layouts: true,
},
},
buildModules: ['@nuxtjs/tailwindcss'],
modern: true,
tailwindcss: {
configPath: '~~/tailwind.config.js',
viewer: false,
},
meta: {
title: 'Santrek Admin',
link: [
{
rel: 'icon',
href: '/favicon.svg',
type: 'image/svg+xml',
},
],
},
});
Additional context
Logs
-
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
How to auto import Components in Source Content folder?
So, how to auto import such component inside content folder? I tried this in nuxt.config.ts : (It doesn't work). import { defineNuxtConfig } ......
Read more >The components Property - Nuxt
Nuxt 2.13+ can scan and auto import your components. ... With components: true , by default the ~/components directory will be included.
Read more >Is there a way to auto import components? : r/sveltejs - Reddit
Instead of doing the imports manually , is there a way to automatically import all of the components from a certain directory? https://i.imgur....
Read more >How to auto import several components in Nuxt?
I then import these components into a page component/template by doing this: import components from '@/components/blocks'; export default { ...
Read more >auto-import-global-components - npm
Automatically searches for exported components in folders you specify through plugin-registration in webpack.config. ... Each component can have ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@mihail727 do this instead for components:
@duckies yea I can also see this issue, in the stackblitz repo, use
@/components
as that one is working as~/components
isn’t for the arrayI’m encountering a similar issue where component resolution is failing when using a non-default
srcDir
. Reproduction.You can temporarily fix this by appending
srcDir
to your component directories, e.g.