控制台错误消息如下所示
script5017 syntax error in regular expression
chunk-vendors.js (96290,5)chunk-vendors.js
!*** ./node_modules/core-js/modules/es.regexp.constructor.js ***!
...
result = inheritIfRequired(NativeRegExp(pattern, flags), thisIsRegExp ? this : RegExpPrototype, RegExpWrapper); // line 96290
...main.js
import 'core-js/stable'
import "core-js/es/symbol";
import 'regenerator-runtime/runtime'
import 'intersection-observer' // Optional
import Vue from 'vue'
import App from './App.vue'
import { BootstrapVue, IconsPlugin } from 'bootstrap-vue'
// fontawesome 6.1.1
import { library } from '@fortawesome/fontawesome-svg-core'
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
import { fas } from '@fortawesome/free-solid-svg-icons';
import { far } from '@fortawesome/free-regular-svg-icons';
// Import Bootstrap an BootstrapVue CSS files (order is important)
import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue/dist/bootstrap-vue.css'
// Make BootstrapVue available throughout your project
Vue.use(BootstrapVue)
// Optionally install the BootstrapVue icon components plugin
Vue.use(IconsPlugin)
Vue.component('font-awesome-icon', FontAwesomeIcon)
Vue.config.productionTip = false
new Vue({
router,
render: h => h(App),
}).$mount('#app')
library.add(
fas,
far
)我也用BootstrapVue。我觉得BootstrapVue有时会和fortawesome发生冲突。有时,当我使用BootstrapVue时,即使是在铬中,它也不能很好地加载。所以我在这个来源中添加了关于这件事的声明
无论如何,我不知道为什么js不通过脚本5017加载错误。这是core-js错误还是BootstrapVue错误?
我用过
@fortawesome/fontawesome-common-types 6.1.1
@fortawesome/vue-fontawesome 2.0.6
core-js 3.20.2
bootstrap 4.6.1
bootstrap-vue 2.21.2
发布于 2022-06-22 10:28:21
看起来您正在使用字体Awese6,它已经不支持IE11了。
您可以降级到字体Awese5,其中的有吗?。
您的package.json应该如下所示:
{
"devDependencies": {
"@fortawesome/fontawesome-svg-core": "1.2.36",
"@fortawesome/free-regular-svg-icons": "^5.15.4",
"@fortawesome/vue-fontawesome": "^0.1.10",
},
"resolutions": {
"@fortawesome/fontawesome-svg-core": "1.2.36"
}
}然后使用yarn或npm i进行更新。
注意,据我所知,"core" <1.3 + *-icons =5.15.4 + vue-fontawesome <1版本对应于"Font < 6“。
resolutions部分可能没有必要,但我很难说服纱线实际上降低到1.3.0以下,不管是什么原因。
您可能需要检查node_modules/@fortawesome/fontawesome-svg-core/package.json以确认已安装的版本。
问题确实是缺少对Unicode RegExes在IE11中的支持,字体Awese6所依赖的。
我花了一些时间试图让它与@babel/plugin-proposal-unicode-property-regex一起工作,但没有成功。
https://stackoverflow.com/questions/71822727
复制相似问题