Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

最新的1.2.2版本roadhog+dva在IE11报错了 #419

Closed
old-wang opened this issue Sep 6, 2017 · 15 comments
Closed

最新的1.2.2版本roadhog+dva在IE11报错了 #419

old-wang opened this issue Sep 6, 2017 · 15 comments

Comments

@old-wang
Copy link

old-wang commented Sep 6, 2017

Environment(required) | 环境(必填)

  • roadhog version(roadhog版本):0.6.0和1.2.2
  • Nodejs and Npm version(Nodejs 和 Npm 版本):6.9.2 & 3.10.10
  • Operating environment (e.g. OS name) and its version(操作系统版本):win10

What did you do? Please provide steps to re-produce your problem.(请提供复现步骤)

使用了es6-promise转换Promise
使用dva+roadhog+sass,一开始使用0.6.0版本roadhog,可以在IE上显示,由于还不支持sass,所以样式失效,升级到1.2.2版本,在chrome上正常显示(样式也成功),但是在IE11(及以下)上运行,报出:SCRIPT1002: 语法错误

What do you expected?(预期的正常效果)

在IE11上应和chrome上一样正常显示,不报错

What happen?(发生了何种非正常现象)

IE11下无法显示页面,并报错:SCRIPT1002: 语法错误

Re-producible online demo (可复现的在线demo)

---index.js---

import dva from 'dva';
import {reducer as ToastReducer} from 'react-redux-toastr';
import thunk from 'redux-thunk';
import createLoading from 'dva-loading'
import { persistStore, autoRehydrate } from 'redux-persist';
import {asyncSessionStorage} from 'redux-persist/storages';
import 'es6-promise/auto';
import * as Toast from './components/toast';
import './styles/sytle.scss';

// 1. Initialize
const app = dva({
  extraReducers: {
    toastr: ToastReducer,
  },
  onAction: [thunk],
  onError: (e) => {
    Toast.addAlert(Toast.ERROR, e.message);
  },
  extraEnhancers: [autoRehydrate()],
});

// 2. Plugins
app.use(createLoading());

// 3. Model
app.model(require('./models/base.js'));//全局都有使用的model在此引用
app.model(require('./models/exam.js'));
app.model(require('./models/result.js'));
app.model(require('./models/study.js'));
app.model(require('./models/selfExamination.js'));

// 4. Router
app.router(require('./router'));

// 5. Start
app.start('#root');
persistStore(app._store, {storage: asyncSessionStorage, blacklist: ['loading', 'toastr', 'study', 'result']});
@sorrycc
Copy link
Owner

sorrycc commented Sep 6, 2017

没有 IE 环境,帮不了你。通常 chrome 能运行 IE 不能运行都是兼容问题,可能少了啥 polyfill 吧。

@old-wang
Copy link
Author

old-wang commented Sep 6, 2017

在用0.6.0版本的时候,是报过Promise未定义,然后我引用了es6-promise,使用redux-logger中间件的时候会报一个没有assign属性,然后我把这个中间件注释掉,在IE上就能显示了,就是无法使用sass,升级到1.2.2之后,ie就报错了,页面也无法访问,而且是const app = dva()开始就报错了,后面没有执行到

@codering
Copy link
Contributor

codering commented Sep 6, 2017

可能少了 Object.assign,
也许和这个一样 facebook/create-react-app#3046
@sorrycc

@duwei54
Copy link

duwei54 commented Sep 18, 2017

楼主解决了么 我也遇到这个问题 不止从何入手

@old-wang
Copy link
Author

还没,具体错误定位不到

@louis-pvs
Copy link

louis-pvs commented Sep 21, 2017

这问题就算加了 pollyfill 也解决不了

也发现在只有在development会出现问题,production能在IE运行,syntax error 里出现很多有关颜色相关的代码,初步猜测与被chalk这库影响。

@Cody1988
Copy link

这个问题解决了么?我也遇到了这个问题,关键是IE太不方便调试了,找不到准确的报错的点

@wuyunjiang
Copy link

如果你用的是fetch

npm i promise-polyfill -S

request下加如下代码

import Promise from 'promise-polyfill'
if (!window.Promise) {
    window.Promise = Promise;
}

@xuqiang1227
Copy link

打包出来部署到nginx中是正常的。
开发时,IE提示:语法错误。目前没有找到有效的解决办法。

@HelloHxz
Copy link

HelloHxz commented Nov 28, 2017

语法错误 是:node_modules/roadhog/node_modules/ansi-styles/index.js 这个文件导致,到前端还是ES6没有转成ES5 ,
_20171128110207

我也很困扰

@HelloHxz
Copy link

_20171128114723

Object.defineProperty(module, 'exports', {
	enumerable: true,
	get: function(){
    return {};
  }
});

@yourenA
Copy link

yourenA commented Jan 8, 2018

各位dalao怎么解决这个问题了?

@476474988
Copy link

我引入babel-polyfill ,并放在index.js的dva前面import后,开发环境在IE11上可以正常打开。但是打包后去访问,IE则报“SCRIPT1028: 缺少标识符、字符串或数字“,发现打包后的index.js有function r(e){return e&&e.__esModule?e:{default:e}}。default是IE的关键字,没有转成‘default’。请问在哪里配置下,可以把IE关键字转换下

@sorrycc sorrycc closed this as completed Feb 2, 2018
@luoboding
Copy link

@476474988 我也遇到相同的问题,请问如何解决的呢?

@476474988
Copy link

476474988 commented Jan 14, 2019

@luoboding

在index.html中添加
<meta http-equiv="X-UA-Compatible" content="IE=EDGE" />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests