使用fortawesome时,脚本5017语法错误发生在Internet Explorer中11
控制台错误消息就像在此语句下
script5017 syntax error in regular expression
chunk-vendors.js (96290,5)
块-Dendors.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
时,它也无法很好地加载。因此,无论如何,我在此源中添加了有关它的声明
,我不知道为什么脚本5017错误会加载JS。这可以是core-js
错误还是bootstrapvue
错误?
我使用
@fortawesome/fontawesome-common-types
6.1.1
@fortawesome/vue-fontawesome
2.0.6
core-js
3.20.2
< 3.20.2 <代码> bootstrap 4.6.1
bootstrap-vue
2.21.2
The console error message is like under this statement
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
)
I use BootstrapVue
too. I feel sometimes BootstrapVue
makes some conflicts with fortawesome
. Sometimes it is not loaded well when I used BootstrapVue
with even in chrome. So I added the statement about it in this source
Anyway, I don't know why js isn't loaded by script 5017 error happens. Can this be core-js
error or BootstrapVue
error?
I used
@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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您似乎使用的是 Font Awesome 6,它不支持 IE11 不再有。
您可以降级到 Font Awesome 5,可以。
您的
package.json
应如下所示:然后使用
yarn
或npm i
进行更新。注意版本
"core" <1.3
+*-icons =5.15.4
+vue-fontawesome <1
,对应于“Font据我所知,很棒 < 6 英寸。解决方案
部分可能不是必需的,但无论出于何种原因,我很难说服yarn实际降级到1.3.0
以下。您可能需要检查
node_modules/@fortawesome/fontawesome-svg-core/package.json
以确认安装的版本。问题确实是 缺少对Font Awesome 6 所依赖的 IE11 中的 Unicode RegExes。
我花了一些时间尝试使其与
@babel/plugin-proposal-unicode-property-regex
没有成功。It looks like you're using Font Awesome 6, which does not support IE11 any more.
You could downgrade to Font Awesome 5, which does.
Your
package.json
should look something like this:Then update with
yarn
ornpm i
.Note versions
"core" <1.3
+*-icons =5.15.4
+vue-fontawesome <1
, which correspond to "Font Awesome < 6", as far as I could tell.The
resolutions
part might not be necessary, but I had a hard time convincing yarn to actually downgrade below1.3.0
, for whatever reason.You might want to check
node_modules/@fortawesome/fontawesome-svg-core/package.json
to confirm the installed version.The issue is indeed the missing support for Unicode RegExes in IE11, which Font Awesome 6 relies on.
I've spent some time trying to make it work with
@babel/plugin-proposal-unicode-property-regex
to no success.