?Vue2項(xiàng)目打包優(yōu)化時(shí),引入element-ui 配置 CDN 加速時(shí)報(bào)錯(cuò)出現(xiàn)報(bào)錯(cuò)信息:Uncaught TypeError: Cannot read properties of undefined (reading 'prototype')
老師說出現(xiàn)這個(gè)問題的原因是,如果你完整引入了 Element,它會(huì)為 Vue.prototype 添加如下全局方法:$alert, $promp......
?文章來源:http://www.zghlxwxcb.cn/news/detail-569011.html
?所以,如果想要正常使用Element-UI,需要先引入Vue
?在 externals 下把 vue 也一起配了
?
此時(shí)再重新打包,控制臺(tái)就沒有報(bào)錯(cuò)了,試了下,項(xiàng)目也能正常運(yùn)行文章來源地址http://www.zghlxwxcb.cn/news/detail-569011.html
到了這里,關(guān)于Vue2項(xiàng)目打包時(shí),引入element-ui 配置 CDN 加速時(shí)報(bào)錯(cuò) Cannot read properties of undefined (reading ‘prototype‘)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!