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

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

Open
LuXDAmore opened this issue Jan 17, 2024 · 5 comments
Open

Comments

@LuXDAmore
Copy link

LuXDAmore commented Jan 17, 2024

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
Copy link
Owner

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

@LuXDAmore
Copy link
Author

@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
Copy link
Owner

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

@LuXDAmore
Copy link
Author

@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
Copy link

I get this warn too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants