簡體   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