[go: nahoru, domu]

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

Exception thrown and not caught #2

Closed
xcatliu opened this issue Dec 22, 2015 · 8 comments
Closed

Exception thrown and not caught #2

xcatliu opened this issue Dec 22, 2015 · 8 comments

Comments

@xcatliu
Copy link
Owner
xcatliu commented Dec 22, 2015

No description provided.

@xcatliu
Copy link
Owner Author
xcatliu commented Dec 22, 2015

Same issue: facebook/react#3682

@xcatliu
Copy link
Owner Author
xcatliu commented Dec 23, 2015

Related issue reduxjs/react-redux#133

@xcatliu
Copy link
Owner Author
xcatliu commented Dec 23, 2015

Related to https://phabricator.babeljs.io/T2322

@xcatliu
Copy link
Owner Author
xcatliu commented Dec 23, 2015

Related to reduxjs/react-redux#227

@xcatliu
Copy link
Owner Author
xcatliu commented Dec 23, 2015

Object.defineProperty should be wrapped in a try catch statement, like react/src/shared/utils/canDefineProperty.js

@xcatliu
Copy link
Owner Author
xcatliu commented Dec 23, 2015

Babel might transform your source to Object.defineProperty, be careful to use babel if you want to support ie8.
See reduxjs/react-redux#227

@xcatliu xcatliu closed this as completed Dec 23, 2015
@xcatliu
Copy link
Owner Author
xcatliu commented Jan 6, 2016
/**
 * CANNOT use `import` to import `es5-shim`,
 * because `import` will be transformed to `Object.defineProperty` by babel,
 * `Object.defineProperty` doesn't exists in IE8,
 * (but will be polyfilled after `require('react-ie8')` executed).
 */
/**
 * CANNOT use `import` to import `react` or `react-dom`,
 * because `import` will run `react` before `require('react-ie8')()`.
 */

@Wind4
Copy link
Wind4 commented Mar 31, 2016

Write ES6 code

import 'es5-shim';
import 'es5-shim/es5-sham';
import 'console-polyfill';
import 'es6-promise';
import 'fetch-ie8';

import React from 'react';
import ReactDOM from 'react-dom';

ReactDOM.render(
  <div className="root">Hello</div>,
  document.getElementById('root'),
);

the babel will transform to:

'use strict';

require('es5-shim');
require('es5-shim/es5-sham');
require('console-polyfill');
require('es6-promise');
require('fetch-ie8');

var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _reactDom = require('react-dom');
var _reactDom2 = _interopRequireDefault(_reactDom);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

_reactDom2.default.render(_react2.default.createElement(
  'div',
  { className: 'root' },
  'Hello'
), document.getElementById('root'));

So, we can use the 'import' syntax.

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

No branches or pull requests

2 participants