在IE 11和IE 10中,下面一行出现了无效的字符错误:
if (!plugin.$element.attr(``data-${ pluginName }``)) {
我知道这是由于ES6不受支持,但我不知道如何解决这个问题。基金会已经包括babel和我认为下面的脚本可以解决问题,但没有。
return gulp.src(PATHS.javascript)
.pipe($.sourcemaps.init())
.pipe($.babel())
.pipe($.concat('foundation.js', {
newLine:'\n;'
}))
.pipe($.if(isProduction, uglify))
.pipe($.if(!isProduction, $.sourcemaps.write()))
.pipe(gulp.dest('assets/javascript'))
.pipe(browserSync.stream());
});这是基金会包含的foundation.core.js文件中的一个问题。
要查看此问题,您可以导航到下面的url并在IE11或10:http://b20.2c7.mwp.accessdomain.com/中加载它
有人有办法解决这个问题吗?
发布于 2016-11-08 20:25:58
我通过重新安装保龄球来解决这个问题,它运行得很好。奇怪..。
发布于 2018-06-27 08:38:45
11不支持某些ES6特性。与这些不受支持的是模板文字,。
有关兼容性,请参见literals。
最好的方法是使用babel及其插件来转换模板文字。
安装babel插件
npm install --save-dev babel-plugin-transform-es2015-template-literals在插件部分的.babelrc中添加它
// without options
{
"plugins": ["transform-es2015-template-literals"]
}
// with options
{
"plugins": [
["transform-es2015-template-literals", {
"loose": true,
"spec": true
}]
]
}在gulpfile.babel.js中,请确保所有内容都是通过babel-加载程序解析的,因此可能会注释掉排除的文件(其中大部分是与基础相关的),因为这些文件是通过babel-加载程序解析的。
因此,如本例中的文字:
`foo${bar}`;会变成这样:
"foo" + bar;见更多信息:https://www.npmjs.com/package/babel-plugin-transform-es2015-template-literals
https://stackoverflow.com/questions/40495507
复制相似问题