nuxt: Generate is not work correctly
After running nuxt generate operation, the page of index.html can load correctly. But its JS dependencies aren’t working unless the components locate in the layouts folder. Finally, if the version is oldest, it will work normally.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 1
- Comments: 17
@SyedAman - I just figured it out! Generating to
/distdoesn’t just generate static files that can be opened as HTML files in a browser. You must point a local server (ie. nginx) at the/distdirectory and access via the server, such aslocalhost:8000.So if you haven’t already, install
nginx, then point younginx.conf’s file’s root location at the/distfolder you want to serve…And that works for me!
@gvinter @KermitLi
I didn’t need to use nginx. I fixed it!
Check out: https://nuxtjs.org/api/configuration-router/
I just had to add
and it deployed properly
@KermitLi you should be fine with the fixes mentioned above.