我正在努力让一个演示工作,它在Chrome中工作正常但在IE11中失败。
语法错误与eval()有关,但只是IE11的问题。这里可以看到一个问题的例子(用IE11查看):
我已将.babelrc文件修改为:
{
"presets": [
["env", {
"modules": false,
"targets": {
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
}
}],
"stage-2"
],
"plugins": ["transform-runtime"],
"env": {
"test": {
"presets": ["env", "stage-2"],
"plugins": ["istanbul"]
}
}
}
我的webpack.base.conf.js文件已更改为包含babel-polyfill,但似乎没有任何帮助解决问题。
app: ['babel-polyfill', './src/main.js']
非常感谢任何建议。
答案 0 :(得分:1)
我有类似的问题。就我而言,这是因为我在.vue
:lang="coffee"
中使用了coffeescript。
该脚本未转换为ES5,因此我编辑了vue-loader.conf.js
以转换coffeescript。
我已按vue-cli
+ vuejs-templates/webpack
“构建/ utils.js”
exports.scriptLoaders = function (options) {
options = options || {}
const coffeeLoader = {
loader: 'coffee-loader',
options: {
transpile: {
presets: ['env', 'es2015']
}
}
}
const jsLoader = {
loader: 'babel-loader'
}
return {
js: jsLoader,
coffee: coffeeLoader
}
}
“构建/ VUE-loader.conf.js”
module.exports = {
loaders: Object.assign({},
utils.cssLoaders({
sourceMap: isProduction
? config.build.productionSourceMap
: config.dev.cssSourceMap,
extract: isProduction
}),
utils.scriptLoaders()),
transformToRequire: {
video: 'src',
source: 'src',
img: 'src',
image: 'xlink:href'
}
}
这是回购: https://github.com/wataruoguchi/play-vue-cli/commit/0bdb9badf82e60696adb393bc351c48a3e69072c
最后我没有使用“babel-polyfill”。
答案 1 :(得分:-3)
IE不支持箭头功能和语法错误&#39;记录在行:
boolean: val => (typeof val === 'string' ? val === '' || val === 'true' ? true : (val === 'false' || val === 'null' || val === 'undefined' ? false : val) : val),
供应商文件中的。