请教, vue3.0+vite+typescript 生产环境部署

2021-05-21 19:32:51 +08:00
 gzf6

开发环境正常,生产环境报如下错误:

vendor.9aa51dcf.js:1 TypeError: l is not a function
    at eO (vendor.9aa51dcf.js:72)
    at JE (vendor.9aa51dcf.js:72)
    at vendor.9aa51dcf.js:77
    at E (vendor.9aa51dcf.js:77)
    at O (vendor.9aa51dcf.js:77)
    at uv (vendor.9aa51dcf.js:15)
    at vendor.9aa51dcf.js:15
    at ft.n [as effect] (vendor.9aa51dcf.js:1)
    at ft.get value [as value] (vendor.9aa51dcf.js:1)
    at it (vendor.9aa51dcf.js:1)

如何定位这类错误?

2450 次点击
所在节点    Vue.js
8 条回复
Curtion
2021-05-21 21:11:19 +08:00
打开 sourceMap,看是哪里报错了
gzf6
2021-05-21 21:36:30 +08:00
@Curtion build 之后的文件,查看后是这里面的 l 报错,不知道具体对应哪里出错
```
function mt(e, t, n, o=!0) {
t && t.vnode;
if (t) {
let o = t.parent;
const a = t.proxy
, r = n;
for (; o; ) {
const t = o.ec;
if (t)
for (let n = 0; n < t.length; n++)
if (!1 === t[n](e, a, r))
return;
o = o.parent
}
const l = t.appContext.config.errorHandler;
if (l)
return void ht(l, null, 10, [e, a, r])
}
!function(e, t, n, o=!0) {
console.error(e)
}(e, 0, 0, o)
}
```
Curtion
2021-05-21 21:53:30 +08:00
https://vitejs.dev/config/#build-sourcemap 你在生产环境打开 sourcemap,然后就可以看到是哪报错了
gzf6
2021-05-21 22:23:27 +08:00
@Curtion 排查后是 element-plus 的问题,只要模板中出现 el 的组件就会报错,开发模式倒是正常的
lupkcd
2021-05-22 23:17:34 +08:00
同遇到 element-plus 非全局引入 设置语言为中文 生产报错
muunala10221
2021-05-24 18:21:02 +08:00
这好坑啊,最后怎么解决的
iamkun
2021-05-26 12:06:48 +08:00
方便提供一个可复现的 demo, 或贴一个 issue 地址?
gzf6
2021-05-26 15:57:24 +08:00
@iamkun 应该是我的国际化的服务的加载顺序问题,暂时去掉 i18n 的配置,直接配置 locale 后就好了

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/778435

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX