Skip to content

[v4]: Request timeout while loading module #32789

@urbanambroz

Description

@urbanambroz

Environment

  • Operating System: Windows_NT
  • Node Version: v20.19.4
  • Nuxt Version: 4.0.1
  • CLI Version: 3.26.4
  • Nitro Version: 2.12.4
  • Package Manager: [email protected]
  • Builder: -
  • User Config: modules, components, compatibilityDate, css, devServer, devtools, icon, runtimeConfig, ui, vite
import tailwindcss from '@tailwindcss/vite';
import devtoolsJson from 'vite-plugin-devtools-json';

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
    modules: ['@nuxt/ui', '@nuxt/eslint'],
    components: {
        global: true,
        dirs: [
            {
                // TODO: can probably be removed after we migrate all components from Blazor by simply renaming the folder
                // to 'components' without the initial uppercase letter
                path: '~/components',
                pathPrefix: false,
            },
        ],
    },
    compatibilityDate: '2025-07-16',
    css: ['~/assets/css/main.css'],
    devServer: {
        port: 5175,
    },
    devtools: { enabled: true },
    icon: {
        mode: 'css',
        cssLayer: 'icon',
        serverBundle: 'local',
    },
    runtimeConfig: {
        public: {
            factsetApiVersion: 'v4',
        },
        serverApiBase: process.env.SERVER_API_BASE || 'http://localhost:54909', // where the server API is being hosted for SSR access, http://localhost is set in Dockerfile
        appVersion: '',
        serverId: '',
        seqUrl: process.env.SERILOG__WRITETO__0__ARGS__SERVERURL || 'http://localhost:30004',
        seqApiKey: '',
    },
    ui: {
        colorMode: false,
        theme: {
            colors: ['primary-dark', 'primary', 'tertiary', 'trend-positive', 'trend-negative', 'white'],
        },
    },
    vite: {
        plugins: [tailwindcss(), devtoolsJson()],
        server: {
            hmr: {
                timeout: 60000, // 60 seconds
            },
            watch: {
                awaitWriteFinish: {
                    stabilityThreshold: 2000, // 2 seconds
                },
            },
        },
    },
});

Reproduction

At random but frequent enough, sometimes it happens when running HMR, other times when starting the project already

Describe the bug

Image

the issue seems to happen quite frequently and for different modules (added the id of the module to the error that is being printed to make sure), sometimes its the date-fns, sometimes @nuxt/ui other times some of our other 3rd party libraries that are proprietary.

We never experienced this issue on Nuxt v3 and it only started happening last week when we migrated to v4.

We tried increasing the Vite timeout as you can see in our config but that didn't help either.
The only thing that seems to "help" is force saving the nuxt.config.ts which forces Nuxt to restart but even that doesn't work all the time, rerunnning npm run dev also doesn't always result in a successful build

Additional context

No response

Logs

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions