Umi: 通过yarn create umi 创建了工程,配置了targets:{ie:11}, 在ie11浏览器下依然报语法错误

Created on 24 Apr 2019  ·  11Comments  ·  Source: umijs/umi

What happens?

刚刚通过yarn create umi 创建了工程,.umirc.js 配置了targets:{ie:11}, 但是在ie11下依然报错;一个月之前创建的工程这样配置之后ie11运行正常。为什么之前创建的工程 package.json 中 "umi": "^2.6.8" , 现在新创建的 是 "umi": "^2.6.3" ?

How To Reproduce

  1. 通过脚手架创建工程 :yarn create umi
  2. 安装依赖 : yarn
  3. 修改 .umirc.js 配置 targets:{ ie:11 }
  4. 启动 npm run start
  5. ie11 浏览器中输入 http://localhost:8000

Expected behavior
1.希望能够正常在ie11 中运行

Context

  • Umi Version: package.json 中 "devDependencies": {"umi": "^2.6.3"}
  • Node Version: 10.15.1
  • Platform: win10
type(bug)

Most helpful comment

应该是开发模式下的问题,build 后不会有问题。

All 11 comments

我也是,创建的是"umi": "^2.6.1",配置targets:{ie:9},在ie10和ie9上运行报错

请提供一下复现步骤和你的配置文件

// yarn create umi 之后,下面是配置文件
import { IConfig } from 'umi-types';

// ref: https://umijs.org/config/
const config: IConfig = {
treeShaking: true,
plugins: [
// ref: https://umijs.org/plugin/umi-plugin-react.html
['umi-plugin-react', {
antd: false,
dva: false,
dynamicImport: false,
title: 'myapp1',
dll: false,

  routes: {
    exclude: [
      /components\//,
    ],
  },
}],

],
targets: {
ie: 9,
},
}

export default config;

复现了
image

应该是开发模式下的问题,build 后不会有问题。

应该是开发模式下的问题,build 后不会有问题。

是在开发模式下有问题,3月份我通过yarn create umi 创建的工程,配置了targets:{ie:11} 之后,在开发模式下ie11 是没问题的, 现在即使配置了,在ie11下会报语法错误,错误指向箭头函数。官网上说 umijs 的一个特性是一键兼容ie9, 通过配置 targets 来实现,是指开发模式下兼容到ie9 吧?

会不会就是我这个问题https://github.com/umijs/umi/issues/2332

@leftstick 你的问题好了吗?

@sorrycc 好了,提交merge后我就测了,没问题

那这个也先 close 了,有问题再 reopen。 @jiangshitou

那这个也先 close 了,有问题再 reopen。 @jiangshitou

已经验证,没有问题了!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nguyenhuutinh picture nguyenhuutinh  ·  3Comments

onReadyL picture onReadyL  ·  3Comments

ddzy picture ddzy  ·  3Comments

sorrycc picture sorrycc  ·  4Comments

tauruswang picture tauruswang  ·  3Comments