我尝试将Vue应用程序部署到Vercel,但在部署时遇到错误。我不认为错误是由Vercel本身引起的,而是prod构建中的某个问题引起的,我找不到原因。
应用程序在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)
此外,将其放入我的主.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"
}
}
你知道我该找什么吗?
2条答案
按热度按时间9rbhqvlz1#
找到了,看起来Vuex在默认情况下将DevTools设置为true,只是不得不将其设置为false:
wwtsj6pe2#
添加这下面的选项在webpack插件工程为我