ant-design-vue-pro icon indicating copy to clipboard operation
ant-design-vue-pro copied to clipboard

本地运行dist包,报Uncaught TypeError: Cannot assign to read only property 'constructor' of object '#<t>'

Open fanxianghuan opened this issue 2 years ago • 13 comments

Question (问题描述) 本地运行dist包,vue.config.js 的publicPath 已改为'./',运行时报错:Uncaught TypeError: Cannot assign to read only property 'constructor' of object '#'

Describe the solution you'd like (你期待的是什么?) 正常显示index页面

Additional context(附加信息) 截屏2022-09-05 下午3 29 34

fanxianghuan avatar Sep 05 '22 07:09 fanxianghuan

能详细提供一下环境吗

sendya avatar Sep 05 '22 16:09 sendya

打包放在随便一个nginx服务器就有这个问题,一样的报错。Ubuntu系统。

sgshy1995 avatar Sep 09 '22 03:09 sgshy1995

同上,一样的报错,macos。vercel也是

mengDot avatar Sep 13 '22 06:09 mengDot

@sendya

mengDot avatar Sep 13 '22 06:09 mengDot

看一下 html 生成的内容是什么样的

sendya avatar Sep 14 '22 03:09 sendya

Windows也一样的错误。 index.html:

<!doctype html><html lang="zh-cmn-Hans"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/logo.png"><title>Ant Design Pro</title><style>.first-loading-wrp{display:flex;justify-content:center;align-items:center;flex-direction:column;min-height:420px;height:100%}.first-loading-wrp>h1{font-size:128px}.first-loading-wrp .loading-wrp{padding:98px;display:flex;justify-content:center;align-items:center}.dot{animation:antRotate 1.2s infinite linear;transform:rotate(45deg);position:relative;display:inline-block;font-size:32px;width:32px;height:32px;box-sizing:border-box}.dot i{width:14px;height:14px;position:absolute;display:block;background-color:#1890ff;border-radius:100%;transform:scale(.75);transform-origin:50% 50%;opacity:.3;animation:antSpinMove 1s infinite linear alternate}.dot i:nth-child(1){top:0;left:0}.dot i:nth-child(2){top:0;right:0;-webkit-animation-delay:.4s;animation-delay:.4s}.dot i:nth-child(3){right:0;bottom:0;-webkit-animation-delay:.8s;animation-delay:.8s}.dot i:nth-child(4){bottom:0;left:0;-webkit-animation-delay:1.2s;animation-delay:1.2s}@keyframes antRotate{to{-webkit-transform:rotate(405deg);transform:rotate(405deg)}}@-webkit-keyframes antRotate{to{-webkit-transform:rotate(405deg);transform:rotate(405deg)}}@keyframes antSpinMove{to{opacity:1}}@-webkit-keyframes antSpinMove{to{opacity:1}}</style><script defer="defer" type="module" src="/js/chunk-vendors.c6b99895.js"></script><script defer="defer" type="module" src="/js/app.a0227494.js"></script><link href="/css/chunk-vendors.59a7dffa.css" rel="stylesheet"><link href="/css/app.58602091.css" rel="stylesheet"><script defer="defer" src="/js/chunk-vendors-legacy.37023499.js" nomodule></script><script defer="defer" src="/js/app-legacy.0565105c.js" nomodule></script></head><body><noscript><strong>We're sorry but vue-antd-pro doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"><div class="first-loading-wrp"><h1>Pro</h1><div class="loading-wrp"><span class="dot dot-spin"><i></i><i></i><i></i><i></i></span></div><div style="display: flex; justify-content: center; align-items: center;">Ant Design</div></div></div></body></html>

ghost avatar Sep 14 '22 23:09 ghost

各位可以在src/core/lazy_use.js把viser-vue相关引用注释掉即可。

mengDot avatar Sep 14 '22 23:09 mengDot

我猜测,在 build 的时候增加 --no-module 命令可以解决

sendya avatar Sep 15 '22 13:09 sendya

大家可以在src/core/lazy_use.js把viser-vue相关引用注释掉。

这个方法可行 后续是否还会因为注释掉这个 导致其他问题 吗

CBH20010703 avatar Oct 10 '22 09:10 CBH20010703

我猜测,在 build 的时候增加 --no-module 命令可以解决

这个 不行 是否能给出一些解决方案

CBH20010703 avatar Oct 11 '22 00:10 CBH20010703

把viser-vue相关引用注释掉以后,问题确实解决了,但是仪表盘的图表都无法显示了,还有其他解决方法吗

noovertime7 avatar Oct 15 '22 06:10 noovertime7

@sendya

noovertime7 avatar Oct 15 '22 06:10 noovertime7

可以尝试一下这个方法。https://blog.csdn.net/m0_49280365/article/details/124729410 @noovertime7 @CBH20010703

Microhawk avatar Oct 21 '22 10:10 Microhawk