javascript - 在生产构建中启用 Nuxt 源映射
问题描述
我最近在 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
文件夹进行了比较,并没有什么不同寻常的地方。
源地图在这里会非常有用,但我无法加载它们。如何在 ? 中启用源nuxt.config.js
映射NODE_ENV = production
?
解决方案
可以通过扩展 nuxt webpack 配置(参见https://nuxtjs.org/docs/2.x/configuration-glossary/configuration-build#extend)启用 nuxt prod 构建的源映射,如下所示:
export default {
build: {
extend(config) {
config.devtool = 'source-map'
}
}
}
推荐阅读
- c++ - 这是 GoogleTest AssertionResult 中的错误吗?
- file-upload - swagger-annotations @Schema 不提供定义属性的方法
- json - 如果列名包含 APOSTROPHE('s),则无法在 SQLSERVER 中插入 JSON 数据
- html - 使用填充而不是使用 CSS 的边距居中(没有额外的包装 DIV)
- node.js - 试图在 Postgresql 中插入地理价值,但它显示语法错误
- java - 在特定情况下实现等于/哈希码以检查列表是否是子列表的子集
- html - 单击时文本旁边的复选框未启用,它始终是第一个
- javascript - 如何在 reactJs 中做 webRTC
- css - 我无法对有关 css-loader 的 boostrap 问题做出反应
- amazon-web-services - 查找谁在联合 AWS 账户中创建了 s3 存储桶