Nuxt generate is keeping my dynamic routes working











up vote
0
down vote

favorite
1












I am using nuxt for a static webapp, using "mode: spa" and "nuxt generate".



The docs say that dynamic routes do not work with this, but my app (/dist) still works on static server after generating, even though the routes aren't generated. I cant figure out why.



Before generating, my routes look like:



export function createRouter () {
return new Router({
mode: 'history',
base: '/',
routes: [
{
path: "/",
component: _36d3a217,
name: "index"
},
{
path: "/:focus",
component: _fbe76838,
children: [
{
path: "",
component: _6d415767,
name: "focus"
},
{
path: ":view",
component: _19cdee48,
name: "focus-view"
}
]
}
],
fallback: false
})
}



Now, the generated /dist does not create the /focus directory as expected...But In my app, I am using route URL params to query an API and it still works.



ie a route like below, the component will use "thisFocus" and "thisView" as parameters in the API:



/thisFocus/thisView



Since the dynamic routes do not exist in /dist, i would think that this would not work anymore. So how does the app still use those URL params successfully without the routes existing?



Edit: another more simple way to ask maybe: why can i still access /:focus/:view route.params even though the routes dont exist?










share|improve this question
























  • I think they dont get prerendered which lets you lose both SSR and Prerender advantages, but im 0% sure so curious what someone with knowledge says ;^)
    – Badgy
    Nov 14 at 7:39










  • @Badgy I think youre right. For some reason, SPA mode works with dynamic routes - ive had others confirm. Its not in the documentation...
    – user3869231
    Nov 14 at 18:25















up vote
0
down vote

favorite
1












I am using nuxt for a static webapp, using "mode: spa" and "nuxt generate".



The docs say that dynamic routes do not work with this, but my app (/dist) still works on static server after generating, even though the routes aren't generated. I cant figure out why.



Before generating, my routes look like:



export function createRouter () {
return new Router({
mode: 'history',
base: '/',
routes: [
{
path: "/",
component: _36d3a217,
name: "index"
},
{
path: "/:focus",
component: _fbe76838,
children: [
{
path: "",
component: _6d415767,
name: "focus"
},
{
path: ":view",
component: _19cdee48,
name: "focus-view"
}
]
}
],
fallback: false
})
}



Now, the generated /dist does not create the /focus directory as expected...But In my app, I am using route URL params to query an API and it still works.



ie a route like below, the component will use "thisFocus" and "thisView" as parameters in the API:



/thisFocus/thisView



Since the dynamic routes do not exist in /dist, i would think that this would not work anymore. So how does the app still use those URL params successfully without the routes existing?



Edit: another more simple way to ask maybe: why can i still access /:focus/:view route.params even though the routes dont exist?










share|improve this question
























  • I think they dont get prerendered which lets you lose both SSR and Prerender advantages, but im 0% sure so curious what someone with knowledge says ;^)
    – Badgy
    Nov 14 at 7:39










  • @Badgy I think youre right. For some reason, SPA mode works with dynamic routes - ive had others confirm. Its not in the documentation...
    – user3869231
    Nov 14 at 18:25













up vote
0
down vote

favorite
1









up vote
0
down vote

favorite
1






1





I am using nuxt for a static webapp, using "mode: spa" and "nuxt generate".



The docs say that dynamic routes do not work with this, but my app (/dist) still works on static server after generating, even though the routes aren't generated. I cant figure out why.



Before generating, my routes look like:



export function createRouter () {
return new Router({
mode: 'history',
base: '/',
routes: [
{
path: "/",
component: _36d3a217,
name: "index"
},
{
path: "/:focus",
component: _fbe76838,
children: [
{
path: "",
component: _6d415767,
name: "focus"
},
{
path: ":view",
component: _19cdee48,
name: "focus-view"
}
]
}
],
fallback: false
})
}



Now, the generated /dist does not create the /focus directory as expected...But In my app, I am using route URL params to query an API and it still works.



ie a route like below, the component will use "thisFocus" and "thisView" as parameters in the API:



/thisFocus/thisView



Since the dynamic routes do not exist in /dist, i would think that this would not work anymore. So how does the app still use those URL params successfully without the routes existing?



Edit: another more simple way to ask maybe: why can i still access /:focus/:view route.params even though the routes dont exist?










share|improve this question















I am using nuxt for a static webapp, using "mode: spa" and "nuxt generate".



The docs say that dynamic routes do not work with this, but my app (/dist) still works on static server after generating, even though the routes aren't generated. I cant figure out why.



Before generating, my routes look like:



export function createRouter () {
return new Router({
mode: 'history',
base: '/',
routes: [
{
path: "/",
component: _36d3a217,
name: "index"
},
{
path: "/:focus",
component: _fbe76838,
children: [
{
path: "",
component: _6d415767,
name: "focus"
},
{
path: ":view",
component: _19cdee48,
name: "focus-view"
}
]
}
],
fallback: false
})
}



Now, the generated /dist does not create the /focus directory as expected...But In my app, I am using route URL params to query an API and it still works.



ie a route like below, the component will use "thisFocus" and "thisView" as parameters in the API:



/thisFocus/thisView



Since the dynamic routes do not exist in /dist, i would think that this would not work anymore. So how does the app still use those URL params successfully without the routes existing?



Edit: another more simple way to ask maybe: why can i still access /:focus/:view route.params even though the routes dont exist?







vue.js routing single-page-application nuxt.js nuxt






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 14 at 8:03

























asked Nov 14 at 7:33









user3869231

768




768












  • I think they dont get prerendered which lets you lose both SSR and Prerender advantages, but im 0% sure so curious what someone with knowledge says ;^)
    – Badgy
    Nov 14 at 7:39










  • @Badgy I think youre right. For some reason, SPA mode works with dynamic routes - ive had others confirm. Its not in the documentation...
    – user3869231
    Nov 14 at 18:25


















  • I think they dont get prerendered which lets you lose both SSR and Prerender advantages, but im 0% sure so curious what someone with knowledge says ;^)
    – Badgy
    Nov 14 at 7:39










  • @Badgy I think youre right. For some reason, SPA mode works with dynamic routes - ive had others confirm. Its not in the documentation...
    – user3869231
    Nov 14 at 18:25
















I think they dont get prerendered which lets you lose both SSR and Prerender advantages, but im 0% sure so curious what someone with knowledge says ;^)
– Badgy
Nov 14 at 7:39




I think they dont get prerendered which lets you lose both SSR and Prerender advantages, but im 0% sure so curious what someone with knowledge says ;^)
– Badgy
Nov 14 at 7:39












@Badgy I think youre right. For some reason, SPA mode works with dynamic routes - ive had others confirm. Its not in the documentation...
– user3869231
Nov 14 at 18:25




@Badgy I think youre right. For some reason, SPA mode works with dynamic routes - ive had others confirm. Its not in the documentation...
– user3869231
Nov 14 at 18:25

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53295119%2fnuxt-generate-is-keeping-my-dynamic-routes-working%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53295119%2fnuxt-generate-is-keeping-my-dynamic-routes-working%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

mysqli_query(): Empty query in /home/lucindabrummitt/public_html/blog/wp-includes/wp-db.php on line 1924

How to change which sound is reproduced for terminal bell?

Can I use Tabulator js library in my java Spring + Thymeleaf project?