Nuxt.js: Nuxt doesn't work with `spa` mode and `static` target

Created on 4 Aug 2020  路  5Comments  路  Source: nuxt/nuxt.js

Describe the bug
When I configure nuxt with typescript and spa with static target, app does not load and keeps showing the loading indicator. There are no errors in the console or terminal.

To Reproduce
Steps to reproduce the behavior:

  1. git clone [email protected]:munjalpatel/nuxt-typescript-spa-test.git
  2. cd nuxt-typescript-spa-test
  3. npm i && npm run dev
  4. Observe the issue

Expected behavior
The Index page should properly be displayed.

Video
https://www.dropbox.com/s/jh1yl5erswhs9p3/Components%20_%20Nuxt%20TypeScript.mp4?dl=0

bug-report stale

Most helpful comment

I spent three days trying to debug why my static generated site did not work properly. It almost works so you won't have an issue if you are running yarn dev, but the generated files will be generally incorrect.
None of the official tutorials say anything about this. I have been tearing my hair out. To me it seemed logical that static was closer to a spa and not to a universal app which did not use generate as far as I remember.

Even if nuxt create app won't allow spa static people will still try it because the documentation has no warnings.

All 5 comments

@munjalpatel If you target static to build a static website, you need to be in universal mode (default), not spa.

Is it not related to TypeScript, it's how Nuxt is designed. Static websites are server rendered.

@kevinmarrec in that case, shouldn't nuxt config wizard prevent me from configuring spa in static mode?

@munjalpatel Indeed :)

I'm gonna see with the rest of the team if there are use cases for spa + static.

If it does we need to fix it, and if it does not we'll prevent users doing so :)

I spent three days trying to debug why my static generated site did not work properly. It almost works so you won't have an issue if you are running yarn dev, but the generated files will be generally incorrect.
None of the official tutorials say anything about this. I have been tearing my hair out. To me it seemed logical that static was closer to a spa and not to a universal app which did not use generate as far as I remember.

Even if nuxt create app won't allow spa static people will still try it because the documentation has no warnings.

Thanks for your contribution to Nuxt.js!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you would like this issue to remain open:

  1. Verify that you can still reproduce the issue in the latest version of nuxt-edge
  2. Comment the steps to reproduce it

Issues that are labeled as pending will not be automatically marked as stale.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bimohxh picture bimohxh  路  3Comments

lazycrazy picture lazycrazy  路  3Comments

shyamchandranmec picture shyamchandranmec  路  3Comments

jaredreich picture jaredreich  路  3Comments

vadimsg picture vadimsg  路  3Comments