Skip to content

Static preset doesn't work [Nitro 3.0.1-alpha.1] #3843

Closed

Description

@syahzuan

Environment

Nitro: 3.0.1-alpha.1
Vite: 7.2.6

Reproduction

I am using this example from nitro repo with only one change - adding the static preset.

Example: https://github.com/nitrojs/nitro/tree/main/examples/vite-ssr-vue-router
Change:

//
import vue from "@vitejs/plugin-vue";
import { defineConfig } from "vite";
import devtoolsJson from "vite-plugin-devtools-json";
import { nitro } from "nitro/vite";

export default defineConfig((_env) => ({
    plugins: [patchVueExclude(vue(), /\?assets/), devtoolsJson(), nitro()],
    environments: {
        client: {
            build: { rollupOptions: { input: "./app/entry-client.ts" } },
        },
        ssr: { build: { rollupOptions: { input: "./app/entry-server.ts" } } },
    },
    nitro: {
        preset: "static",
        prerender: {
            routes: ["/", "about"],
        },
    },
}));

// Workaround https://github.com/vitejs/vite-plugin-vue/issues/677
function patchVueExclude(plugin, exclude) {
    const original = plugin.transform.handler;
    plugin.transform.handler = function (...args) {
        if (exclude.test(args[1])) return;
        return original.call(this, ...args);
    };
    return plugin;
}

Describe the bug

Building with non-static preset such as default, 'vercel', 'cloudflare_pages' succeed.
Building with static preset such as 'static', 'vercel-static, 'cloudflare_pages_static' fail with this error message:

error during build:
rollupOptions.input should not be an html file when building for SSR. Please specify a dedicated SSR entry.
    at resolveRollupOptions (file:///home/syahzuan/projects/personal/vue-ssg/nitro-v3-vue-ssr-example/node_modules/vite/dist/node/chunks/config.js:33451:73)
    at buildEnvironment (file:///home/syahzuan/projects/personal/vue-ssg/nitro-v3-vue-ssr-example/node_modules/vite/dist/node/chunks/config.js:33506:25)
    at Object.build (file:///home/syahzuan/projects/personal/vue-ssg/nitro-v3-vue-ssr-example/node_modules/vite/dist/node/chunks/config.js:33899:25)
    at buildEnvironments (file:///home/syahzuan/projects/personal/vue-ssg/nitro-v3-vue-ssr-example/node_modules/nitro/dist/_build/vite.plugin.mjs:186:16)
    at async Object.buildApp (file:///home/syahzuan/projects/personal/vue-ssg/nitro-v3-vue-ssr-example/node_modules/vite/dist/node/chunks/config.js:33893:5)
    at async CAC.<anonymous> (file:///home/syahzuan/projects/personal/vue-ssg/nitro-v3-vue-ssr-example/node_modules/vite/dist/node/cli.js:629:3)
error: script "build" exited with code 1

Additional context

I am a beginner learning to integrate Nitro at a lower level without framework. Apology in advance if I am missing something.

Logs

Activity

  1. HummingMind commented on Feb 21, 2026

    @HummingMind

    I am also getting this with the latest nightly.
    Even specifying: serverEntry: "./src/entry-server.ts" doesn't fix it.

    Only seems to work when vite build is used with the --ssr option like this:
    "build": "vite build --ssr src/entry-server.ts"

    Any chance for a quick fix?

    Thank you!

  2. added 2 commits that reference this issue on Aug 7, 2026
    343043e
    f0eb4e7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions