【发布时间】:2022-06-22 18:28:21
【问题描述】:
控制台报错信息就像下面这个语句
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 发生冲突。有时即使在 chrome 中使用 BootstrapVue 时,它也不能很好地加载。所以我在这个来源中添加了关于它的声明
无论如何,我不知道为什么js没有被脚本加载5017错误发生。这是core-js 错误还是BootstrapVue 错误?
我用过
@fortawesome/fontawesome-common-types6.1.1
@fortawesome/vue-fontawesome2.0.6
core-js3.20.2
bootstrap4.6.1
bootstrap-vue2.21.2
【问题讨论】:
-
我找到了a similar issue,并且从cmets中,IE中的错误可能是由于在正则表达式中使用
/u标志引起的。/umodifier 仅在 ECMAScript 6/ES2015 中引入,IE11 仅支持 ES5 标准。您可以深入调查以检查是否是问题所在。
标签: javascript vue.js internet-explorer font-awesome core-js