[英]Nuxt SSR with Firebase Integration
I tried to restructure the project folder so that it can be deployed to Firebase, take a look to this repository Nuxt Firebase Vuetify . 我试图重组项目文件夹,以便可以将其部署到Firebase,看看此存储库Nuxt Firebase Vuetify 。 On nuxt.config.js
I changed the buildDir to ../functions/.nuxt
, at first sight it looks worked. 在nuxt.config.js
我将buildDir更改为../functions/.nuxt
,乍一看它似乎../functions/.nuxt
。 But whenever I use custom component from UI framework like Vuetify, it becomes error. 但是,每当我使用来自UI框架(如Vuetify)的自定义组件时,它就会出错。 On the browser console, there is an error like this 在浏览器控制台上,出现这样的错误
The client-side rendered virtual DOM tree is not matching server-rendered content. 客户端渲染的虚拟DOM树与服务器渲染的内容不匹配。 This is likely caused by incorrect HTML markup, for example nesting block-level elements inside <p>, or missing . 这可能是由于不正确的HTML标记(例如,在<p>内嵌套块级元素或缺少)引起的。 Bailing hydration and performing full client-side render. 保龄水化和执行完整的客户端渲染。
Any idea how can I solve this? 知道我该如何解决吗? Or maybe I missed any other configuration on that project? 还是我错过了该项目上的任何其他配置?
So this is quite old, but I happened to stumble across the same issue just a few days ago, so maybe this can help you or someone else in the future. 因此,这已经很老了,但是几天前我碰巧碰到了同一问题,所以也许这可以对您或其他人有所帮助。
To my understanding, this issue is caused due to the vue
module, which is a dependency of Nuxt, being installed inside the functions folder. 据我了解,此问题是由于vue
模块引起的,该模块是Nuxt的依赖项,安装在functions文件夹中。 When you run Nuxt with the buildDir
set to functions/.nuxt
and import Vue from 'vue'
in your plugins, you get another Vue-class than the one being used by Nuxt. 当您在buildDir
设置为functions/.nuxt
运行Nuxt并import Vue from 'vue'
插件中的import Vue from 'vue'
,您将获得另一个Vue类,而不是Nuxt使用的类。 This is a bug in Nuxt, as far as I know. 据我所知,这是Nuxt中的错误。
How to hotfix this: 如何修复此问题:
nuxt
and vue
modules from your node_modules
inside the functions
directory, all will run regardless. 取出nuxt
和vue
从你的模块node_modules
内部functions
目录,都将不分运行。 Metaphalo's answer works for me, to this I wanted to add that if you have a srcDir: 'src' in which all the nuxt directories are, I recommend adding. Metaphalo的答案对我有用,我想补充一点,如果您有一个srcDir:'src',其中所有nuxt目录都在其中,我建议添加。
nuxt.config nuxt.config
srcDir: 'src', buildDir: process.env.NODE_ENV === 'production' ? 'functions/.nuxt' : '.nuxt',
so you can use the plogins in dev 所以你可以在开发中使用plogins
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.