我正在尝试将我的 Vue 应用程序部署到 Vercel,但在执行时遇到错误。我不认为该错误是由 Vercel 本身引起的,而是产品构建中的某些内容导致了问题,而我找不到原因或原因。
应用程序在 Vite JS (Vue 3) 上启用了 SSR,使用此样板:https://github.com/frandiox/vitesse-ssr-template
构建和部署后,打开/URL 显示此错误:
ReferenceError: __VUE_PROD_DEVTOOLS__ is not defined
at Store.install (/var/task/node_modules/vuex/dist/vuex.cjs.js:911:50)
at Object.use (/var/task/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js:3031:28)
at /var/task/api/renderer/main.js:2694:7
at /var/task/api/renderer/main.js:2098:44
at module.exports (/var/task/api/index.js:16:28)
at Server.<anonymous> (/var/task/___vc_helpers.js:813:19)
at Server.emit (events.js:376:20)
at parserOnIncoming (_http_server.js:896:12)
at HTTPParser.parserOnHeadersComplete (_http_common.js:126:17)
此外,将其放入我的 main.ts 文件中(试图避免问题),不会改变任何内容:
app.config.devtools = false;
app.config.debug = false;
app.config.silent = true;
我的 package.json 的内容在无服务器部署中使用,在 cas 中它很有用:
{
"private": true,
"dependencies": {
"node-fetch": "*",
"@vueuse/core": "^4.9.1",
"@vueuse/head": "^0.5.1",
"nprogress": "^0.2.0",
"vue": "^3.0.11",
"@vue/server-renderer": "^3.0.11",
"vue-i18n": "^9.1.6",
"vue-router": "^4.0.6",
"axios": "^0.21.1",
"@headlessui/vue": "^1.2.0",
"vuex": "^4.0.1"
}
}
知道我应该寻找什么吗?
最佳答案
找到了,好像 Vuex 默认将 DevTools 设置为 true,只需将其设置为 false:
const store = createStore({
devtools: false,
})
关于vue.js - 引用错误: __VUE_PROD_DEVTOOLS__ is not defined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67975438/