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

missing .output/public/index.html after upgrading to RC12 #15340

Closed
flkrnr opened this issue Nov 3, 2022 · 4 comments
Closed

missing .output/public/index.html after upgrading to RC12 #15340

flkrnr opened this issue Nov 3, 2022 · 4 comments

Comments

@flkrnr
Copy link

flkrnr commented Nov 3, 2022

Environment

  • Operating System: Linux
  • Node Version: v16.18.0
  • Nuxt Version: 3.0.0-rc.12
  • Nitro Version: 0.6.0
  • Package Manager: npm@8.19.2
  • Builder: vite
  • User Config: ssr, modules, buildModules, build, css, head, pwa, runtimeConfig
  • Runtime Modules: @nuxtjs/tailwindcss@5.3.5, @vueuse/nuxt@9.4.0, @kevinmarrec/nuxt-pwa@0.8.0
  • Build Modules: @pinia/nuxt@0.4.3

Reproduction

Currently I am building my nuxt3 application without SSR (via setting ssr: false in nuxt.config.ts).
Up until the upgrade from nuxt3 RC11 to RC12 there was an index.html file located in .output/public after building the application using nuxt build and I was able to deploy the generated SPA Application via AWS Amplify as example using the following config:

version: 1
backend:
  phases:
    build:
      commands:
        - '# Execute Amplify CLI with the helper script'
        - amplifyPush --simple
frontend:
  phases:
    preBuild:
      commands:
        - npm ci
    build:
      commands:
        - npm run build
  artifacts:
    # IMPORTANT - Please verify your build output directory
    baseDirectory: /.output/public
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*

Describe the bug

after building locally i noticed that the file .output/public/index.html was missing after upgrading from RC11 to RC12. Now with the index.html file missing, Its is not possible anymore to host a SPA without prerendered routes.

Please correct me if I missunderstood something there ✌️.

Additional context

No response

Logs

No response

@danielroe
Copy link
Member

danielroe commented Nov 3, 2022

Are you running nuxt build? In this case it won't generate the file. Instead you can run nuxt generate and you should be good to go.

Related: nuxt/framework#7831.

@flkrnr
Copy link
Author

flkrnr commented Nov 3, 2022

@danielroe thanks for your response. Yes I was running nuxt build to generate the .output folder. (added it in the issue description) When I'm running nuxt generate every route is generated statically for a prerendered SPA. Isn't it possible anymore to just generate a "classic" not prerendered SPA with one single index.html file? I think in nuxt2 the command was nuxt build --spa .
according to the current nuxt3 docs for nuxi generate The command triggers the nuxi build command with the prerender argument set to true (https://v3.nuxtjs.org/api/commands/generate#nuxi-generate)

@shiva-prasad-reddy
Copy link

I'm having the same issue, using "npm run build" with "ssr: false" is not generating any html files but "npm run generate" with "ssr: false" is prerendering all the routes.

Copy link
Member

This is intended behaviour (not generating the index when running nuxt build) as it prevents runtime config from working when running a server.

To generate only one route you can do:

export default defineNuxtConfig({
  nitro: {
    prerender: {
      crawlLinks: false,
      routes: ['/']
    }
  }
})

@danielroe danielroe closed this as not planned Won't fix, can't repro, duplicate, stale Nov 6, 2022
@danielroe danielroe added the 3.x label Jan 19, 2023
@danielroe danielroe transferred this issue from nuxt/framework Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants