victorgarciaesgi / nuxt-typed-router

🚦Provide autocompletion and typecheck to Nuxt router
https://nuxt-typed-router.vercel.app
MIT License
362 stars 12 forks source link

Annoying Warning: No routes defined. Check if your pages folder exists #137

Open LuXDAmore opened 10 months ago

LuXDAmore commented 10 months ago

Describe the bug

Running command nuxi dev ./src -o cause the warning No routes defined. Check if your pages folder exists, but my pages folder exist. And also the message Router autocompletions generated appear in the console, so I'm not sure about what's happening

Expected behavior

To just have the message ✔ Router autocompletions generated

Screenshots

Warning

Environnement infos

Nuxt Info

Folders: I'm running the project in a folder called backoffice, containing an src folder with the nuxt application inside.

The package.json is in the backoffice folder. The .nuxt folder is in the backoffice/src folder.

Your pages folder structure

Run npx tree-node-cli {your page folder path}

tree-node-cli

Your nuxt.config.ts


// Nuxt
import { defineNuxtConfig } from 'nuxt/config';

// Design system
import { AntDesignVueResolver as antDesignResolver } from 'unplugin-vue-components/resolvers';

// Vite plugins
import components from 'unplugin-vue-components/vite';
import eslintPlugin from 'vite-plugin-eslint';
import { Mode, plugin as mdPlugin } from 'vite-plugin-markdown';

// Package
import { version as projectVersion } from '../package.json';

// Configuration: https://v3.nuxtjs.org/docs/directory-structure/nuxt.config
export default defineNuxtConfig(
    {
        alias: {
            './runtimeConfig': './runtimeConfig.browser',
        },
        antd: {},
        app: {
            head: {
                base: {
                    href: '/',
                    target: '_self',
                },
                charset: 'utf-16',
                htmlAttrs: {
                    lang: 'it',
                    translate: 'no',
                },
                meta: [
                    {
                        content: process.env.NUXT_DESCRIPTION || '',
                        name: 'description',
                    },
                    {
                        content: 'yes',
                        name: 'mobile-web-app-capable',
                    },
                    {
                        content: '#f2f1f3',
                        key: 'theme-color-light',
                        media: '(prefers-color-scheme: light)',
                        name: 'theme-color',
                    },
                    {
                        content: '#1b1a1e',
                        key: 'theme-color-dark',
                        media: '(prefers-color-scheme: dark)',
                        name: 'theme-color',
                    },
                    {
                        content: 'default',
                        key: 'status-bar-light',
                        media: '(prefers-color-scheme: light)',
                        name: 'apple-mobile-web-app-status-bar-style',
                    },
                    {
                        content: 'black-translucent',
                        key: 'status-bar-dark',
                        media: '(prefers-color-scheme: dark)',
                        name: 'apple-mobile-web-app-status-bar-style',
                    },
                ],
                title: process.env.NUXT_TITLE,
                titleTemplate: `%s - ${ process.env.NUXT_TITLE }`,
                viewport: 'width=device-width,initial-scale=1',
            },
        },
        css: [ '~/assets/styles/main.scss', '~/assets/styles/root.scss' ],
        devtools: { enabled: process.env.NODE_ENV !== 'production' },
        experimental: {
            crossOriginPrefetch: true,
            typedPages: true,
            watcher: 'parcel',
            writeEarlyHints: true,
        },
        extensions: [ '.md' ],
        imports: { dirs: [ 'composables/**', 'utils/**' ] },
        modules: [
            'nuxt-typed-router',
            '@nuxt/test-utils/module',
            '@nuxt/devtools',
            '@ant-design-vue/nuxt',
            '@pinia/nuxt',
            '@vueuse/nuxt',
        ],
        runtimeConfig: {
            public: {},
        },
        ssr: false,
        typescript: {
            shim: false,
            strict: true,
        },
        vite: {
            css: { preprocessorOptions: { scss: { additionalData: '@import "~/assets/shared/main";' } } },
            define: {
                'window.global': {},
            },
            plugins: [
                eslintPlugin( { cache: true } ),
                components(
                    {
                        resolvers: [
                            antDesignResolver(
                                {
                                    importStyle: false,
                                    resolveIcons: true,
                                }
                            ),
                        ],
                    }
                ),
                mdPlugin( { mode: [ Mode.MARKDOWN ] } ),
            ],
            ssr: { noExternal: [ 'ant-design-vue', '@ant-design/icons-vue' ] },
            vue: { template: { compilerOptions: { whitespace: 'condense' } } },
        },
    }
);
victorgarciaesgi commented 10 months ago

Do you have set srcDir? That's maybe why it fails

LuXDAmore commented 10 months ago

@victorgarciaesgi Why i have to set it? It's not using the same as Nuxt?

With this command i'm automatically setting the rootDir (see HERE): nuxi dev ./src -o

Otherwise, with which value should i set it?

victorgarciaesgi commented 10 months ago

Yeah i'm talking about the nuxt one! I'm using it. Are the types working even if the message appears?

LuXDAmore commented 10 months ago

@victorgarciaesgi My nuxt.config.ts file is already inside the /src folder: /src/nuxt.config.ts

And the types seems working

Types

Pages folder

zyhnbyyds commented 8 months ago

I get this warn too

Me-Phew commented 2 weeks ago

I'm still getting this with v3.7.0, everything seems to be working fine regardless.