-
-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Versatile Vue.js Application #240
Comments
Please allow the router mode option to be overridden even if this configuration is used. I may configure my web server to send my app bundle on 404 such that client-side routes still work even without hashes, or configure a more traditional web app to route a portion of the URL space to my bundle. In those instances, I want the ability to use regular URLs without the hash. Thanks. |
We develop website use rest api about 4-5 years. we found nuxt.js , it looking amazing , and more fast develop for us but nuxt.js usually give us [[ ReferenceError: window is not defined ]] or documnet we actual know we don't need ssr for project . so , if have an option ssr: false thanks. |
@ausir0726 check out vbuild or vue build as well |
@egoist I love nuxt.js more , and if I can handle SSR very well that can give us a basic perfect SEO for search engine and social media . :D I can see the plugin can working with ssr:false , that's so great :D |
@atinux |
@ausir0726 As a work-around simply one can run nuxt with But this makes Signification performance overhead specially for server applications |
@pi0 yes , |
Really looking forward to 1.0 release for the client bundle. I've been stumbling over painful hydration issues. Thumbs up on the great work so far! |
Looking forward to 1.0 release! When can we be expecting the release? :) |
Actually, after a long talk with the team, SSR will be disable only for the whole application (to build SPA), this way we will be able to disable the server bundle directly and speed up the dev process :) |
@atinux just to be sure. This won't impact 'nuxt generate', we would still be able to generate 100% static apps that can be deployed and served from a CDN using 'nuxt generate' and generate: {
routes: [
'/my-route/my-action',
'/my-route/another-action',
'/projects/dashboad',
...
] in nuxt.config.js Am I correct? |
@sebastianmacias In 1.0, a |
Excellent, thanks for the clarification |
Hi @atinux . I'm happy to see the nuxt team working hard to improve nuxt. For example:
File: store/example.js
Localstorage will ve avaible in store? or this example will result: Currently (before this feature ), is possible localstorage be used in Thanks in advanced. |
Hi @rAugustos Indeed, you won't have to check if you're on server-side or client-side, since with the Right now, to have full SSR feature, you should not use localStorage but a session stored on the server instead. |
Is there an ETA for 1.0? |
You can start playing with And spa example |
@atinux solved this problem this way - https://github.com/egoist/vue-no-ssr |
I see, this is pretty smart actually. BTW, |
@TheDeveloperTom Actually, I forgot about this feature: #1468 (comment) So you can create a |
@atinux is this approach preferred? I mean, is using 'spa' property more preferred, or gives more opportunities? Thank in advance |
@TheDeveloperTom While programmatic enable/disable of SSR per route is available, I would suggest currently using |
Are there still plans to add A use case is waiting for the user auth session to settle (waiting for ajax request to return) before proceeding with rendering. |
@simplesmiler Actually you can perform
module.exports = {
plugins: [{ src: '~/plugins/nuxt-client-init.js', ssr: false }]
}
export default async (ctx) => {
await ctx.store.dispatch('nuxtClientInit', ctx)
} |
@atinux I've been doing this currently with middleware, but I guess plugin is the better way, yes. |
@atinux although possible to do yourself, I think a decision for consistency should be made. To either
|
Would it be possible to do on a component level? I got some client-side only components and it would be far easier if I could just set a property and not think about if lifecycle hooks are run server-side. Plus it opens up for using a lot more components from the vue ecosystem. |
@dotnetCarpenter you can use the |
To everyone who want to use |
@dotnetCarpenter thanks man. |
We can avoid |
FYI, I made a little Nuxt module based on @atinux 's suggestion: https://github.com/BKWLD/nuxt-spa-store-init |
I ran into the same problem using SSR. It works fine under yarn dev but after yarn generate and FTP of the /dist to the site the appendChild error happens. I changed the v-if to v-show (was on a template, v-show does not support templates) and things are working better. |
@atinux thanks for the solution!
|
hey @dotnetCarpenter i'm using <template>
<no-ssr>
<l-map ref="myMap"></l-map>
</no-ssr>
</template>
<script>
export default {
async mounted() {
await this.$nextTick(() => {
let map = this.$refs.myMap.mapObject
map.setView(L.latLng(50.5, 10.5), 11)
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(
map
)
})
}
}
</script> it only works on client-side. when i do a full page refresh i get const checkMapObject = setInterval(() => {
if (this.$refs.map) {
this.map = this.$refs.map.mapObject
clearInterval(checkMapObject)
}
}, 100) |
@atinux I tried to fetch some data with a plugin, but axios is not sending credentials even with explicit // plugins/repository.ts
import { Plugin } from '@nuxt/types'
import { api } from '@/api/repository'
const evaApiPlugin: Plugin = (context, inject) => {
inject('evaApi', api(context.$axios))
}
export default evaApiPlugin // api.ts
export default ($axios: NuxtAxiosInstance) => ({
fetchAllCategories() {
return $axios.$get<CategoryGetAllResponse[]>('/category')
},
}) // plugins/nuxt-client-init.ts
import { Plugin } from '@nuxt/types'
const clientInit: Plugin = async (context) => {
try {
const response = await context.$evaApi.categories.fetchCategories()
console.log('categories', response)
} catch (e) {
console.error(e)
}
}
export default clientInit
Calling api functions inside my components and store works fine but inside plugins dont. All requests with my injected api from plugins is throwing 401 (Unauthorized). Do you know how to solve this issue? |
@Pacheco95, were you able to solve this? Axios requests not sending token. |
Nuxt.js goal is also to create rich vue.js applications easily.
Server side rendering can be hard to handle, so we will introduce a
ssr: false
option innuxt.config.js
.The features will not change:
With this option, we will set the mode to
hash
and introduce anuxt export
command to create adist
folder ready to be deployed on any CDN.We might add a
nuxtClientInit
action in the store since thenuxtServerInit
won't be called if ssr is disabled.The text was updated successfully, but these errors were encountered: