Nuxt generate is keeping my dynamic routes working
up vote
0
down vote
favorite
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
add a comment |
up vote
0
down vote
favorite
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
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
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
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
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
vue.js routing single-page-application nuxt.js nuxt
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
add a comment |
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
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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