問題:測試環境發現vue項目在chore下能正常運行和加載,在IE11下打不開
報錯:
SCRIPT1006: 缺少 ')'
chunk-vendors.js (5149,46)

點擊進入chunk-vendors.js (5149,46) 發現是 crypto-js插件報錯如下

原因:
crypto-js 插件可能不兼容IE11
解決方案:
在vue.config.js配置文件中增加如下配置即可:
module.exports = {
transpileDependencies: ['crypto-js']
}

vue-cli官網中對transpileDependencies的介紹:
transpileDependencies
- Type:
Array<string | RegExp> - Default:
[]默認情況下
babel-loader會忽略所有node_modules中的文件。如果你想要通過 Babel 顯式轉譯一個依賴,可以在這個選項中列出來
參考資料:https://segmentfault.com/a/1190000022217565?utm_source=sf-similar-article
