繁体   English   中英

在生产版本中启用 Nuxt 源映射

[英]Enable Nuxt source maps in production build

我最近在 Nuxt 中构建了一个通用并部署了它。 但是我一直遇到这个错误:

[nuxt] Error while initializing app DOMException: "Node cannot be inserted at the specified point in the hierarchy" app.3bc9463ad06cdf9b6df1.js:formatted:2195
T23V/<
app.3bc9463ad06cdf9b6df1.js:formatted:2195
a
https://wca.findleds.com/_nuxt/vendor.6debe2bdce1d595803d9.js:2:242000
M/<
https://wca.findleds.com/_nuxt/vendor.6debe2bdce1d595803d9.js:2:242145
l
https://wca.findleds.com/_nuxt/vendor.6debe2bdce1d595803d9.js:2:105265
TypeError: "n.setAttribute is not a function"
nrhttps://wca.findleds.com/_nuxt/vendor.6debe2bdce1d595803d9.js:2:43662xhttps://wca.findleds.com/_nuxt/vendor.6debe2bdce1d595803d9.js:2:54236xhttps://wca.findleds.com/_nuxt/vendor.6debe2bdce1d595803d9.js:2:54466xhttps://wca.findleds.com/_nuxt/vendor.6debe2bdce1d595803d9.js:2:54316xhttps://wca.findleds.com/_nuxt/vendor.6debe2bdce1d595803d9.js:2:54466xhttps://wca.findleds.com/_nuxt/vendor.6debe2bdce1d595803d9.js:2:54316Krhttps://wca.findleds.com/_nuxt/vendor.6debe2bdce1d595803d9.js:2:56066_updatehttps://wca.findleds.com/_nuxt/vendor.6debe2bdce1d595803d9.js:2:34144mounthttps://wca.findleds.com/_nuxt/vendor.6debe2bdce1d595803d9.js:2:63373gethttps://wca.findleds.com/_nuxt/vendor.6debe2bdce1d595803d9.js:2:18466runhttps://wca.findleds.com/_nuxt/vendor.6debe2bdce1d595803d9.js:2:19357Eehttps://wca.findleds.com/_nuxt/vendor.6debe2bdce1d595803d9.js:2:17495tehttps://wca.findleds.com/_nuxt/vendor.6debe2bdce1d595803d9.js:2:13945Zthttps://wca.findleds.com/_nuxt/vendor.6debe2bdce1d595803d9.js:2:13447 vendor.6debe2bdce1d595803d9.js:2:13331

我在开发过程中没有遇到任何错误。 我什至配置了生产服务器的重复版本,但没有收到错误消息。 我对.nuxt文件夹进行了区分,并没有发现任何异常。

源映射在这里非常有用,但我无法加载它们。 NODE_ENV = production时,如何在nuxt.config.js启用源映射?

可以通过扩展 nuxt webpack 配置(参见https://nuxtjs.org/docs/2.x/configuration-glossary/configuration-build#extend )来启用 nuxt prod 构建的源映射,如下所示:

export default {
  build: {
    extend(config) {
      config.devtool = 'source-map'
    }
  }
}

通过阅读这个问题,我使用v-if="$auth.loggedIn"将我的非页面组件切换到v-show ,这解决了问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM