Coder Social home page Coder Social logo

react-ie8's Issues

MatchMedia error when run own tests

Pls, can you helpme?

Your project includes the enquirejs dependency. But I have issues when try to run tests into my project because

matchMedia not present, legacy browsers require a polyfill

I don't know how to solve this issue.

this is my code

import React from 'react';
import { shallow } from 'enzyme';
import { expect } from 'chai';

// Import components for testing here
import NavbarCrm from '../NavbarCrmComponent';

describe('<NavbarCrm />', function () {

  if (typeof window !== 'undefined') {
    var matchMediaPolyfill = function matchMediaPolyfill(mediaQuery) {
      return {
        media: mediaQuery,
        matches: false,
        addListener: function addListener() {},
        removeListener: function removeListener() {}
      };
    };
    window.matchMedia = window.matchMedia || matchMediaPolyfill;
  }

  it('should have props for heading and children', function (done) {
    const wrapper = shallow(<Menu />);
    expect(wrapper.props().classes).to.be.defined;
    expect(wrapper.props().children).to.be.defined;
    done();
  });
});

I tried in all methods. Above, below but the same error ever.

Can U help me?

I cant to solve the issue putting

if (typeof window !== 'undefined') {
    var matchMediaPolyfill = function matchMediaPolyfill(mediaQuery) {
      return {
        media: mediaQuery,
        matches: false,
        addListener: function addListener() {},
        removeListener: function removeListener() {}
      };
    };
    window.matchMedia = window.matchMedia || matchMediaPolyfill;
  }

I include the above code in the line 49826 located at andt.js file into my node_modules And the problem is over. but this is not a good solution.

into enquirejs/src/include/wrap.js into the dist file for npm installed module. But it isn't a pretty solution.

how to run in IE8

how to fix IE8(请问如何兼容IE8),when I clone this code and run,but it's still can't run in IE8(下载后仍然无法运行)

IE8 Object.defineproperty 问题

目前错误信息,了解到是某个地方使用了Object.defineproperty,但是我已经重构了代码应该没有这种问题,极有可能是依赖的第三方库的问题,我已经手动改了报错的库例如react-router-redux,并且已经把明确不支持IE8的库要么取消要么降级到支持的版本。现在的错误信息完全没有办法定位到错误。

image

babelrc

image

webpack loaders

image

entry.index.js

image

代码片段如上,如果还需要什么信息我再提供。还请大家帮忙看一下问题,已经愁了我好几天,google都翻烂了,错误信息的位置在core-js,完全没有头绪,感激不尽,感激不尽。

在IE8下无法运行

React Static Boilerplate 的在线演示,用IE8打开直接报错 “HTTP ERROR -2146697208”

react-ie8

run in ie8 。wrong at:‘extends’
babelHelpers.extends = Object.assign || function (target) {

react-router-redux 4.x 中的Object.defineProperty问题

你好,我看到react-router-redux 4.x 中发布的代码部分如下:

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

这样的代码 哪怕用了polyfill 也没法兼容IE8了吧 ?

Babel transform "export xx from 'xxx' " to Object.defineProperty

"Babel transforms your import to Object.defineProperty which doesn't exist in IE8。"
It should be 'export' ,not 'import' . IE8 has Object.defineProperty Object.defineProperty.
now Babel fixed the transform, but has another problem: Babel transform "export xx from 'xxx' " to Object.defineProperty, like:
"
Object.defineProperty(exports, 'LOCATION_CHANGE', {
enumerable: true,
get: function get() {
return _reducer.LOCATION_CHANGE;
}
});
"
the accessor property not support in ie8.
so cannot use react-router-redux because it use "export xx from 'xxx' ";

Production Build

how do i create prod build. Currently the compiled file is quite large.

IE8,firstChild.data.length undefind

in IE8, this will be error.
<div id="etDiv"> <span>4444</span> <div class="abc"></div> </div> <script></script> <script type="text/javascript"> var a = document.getElementById("etDiv"); var b = a.firstChild; alert(b.data.length); </script>

because b.data is undefined in IE8

建议fish样式进行隔离

iconfont的unicode没有‘fish化’,如果antd和fish同时使用 有时候会出问题,建议加前缀什么的 隔离一下

Make your React app work in IE8 with one liner code

As I know, It's very painful to solve compatibility Issues in IE8.
So I'm considering to write a package to help people who are facing such problems.

With just one liner code:

require('react-ie8')(options);

Or insert umd js file into head?

<script src=".../react-ie8.js"></script>
<script>window.reactIE8(options)</script>

有关Object.defineProperties的问题

怎么才能让babel6 的import不生成Object.defineProperties的代码?

我这边已经干掉了好些依赖 不想使用es5-shim等polyfill 有办法么?

Is there a possibility to polyfill react 15?

(We won't actively remove IE 8–related code quite yet, but we will deprioritize new bugs that are reported. If you need to support IE 8 we recommend you stay on React v0.14.)

Officially it's said that IE8 is not supported but they will also not remove IE 8 related compatibility code. So there might be a chance that it still works with polyfills?

webpack-dev-server --inline --hot 报错

--hot 会生成一个 hotCreateRequire 的函数,其中有 indexOf,而 IE8 不支持

if(me.hot.active) {
/******/ 				if(installedModules[request]) {
/******/ 					if(installedModules[request].parents.indexOf(moduleId) < 0)
/******/ 						installedModules[request].parents.push(moduleId);
/******/ 					if(me.children.indexOf(request) < 0)
/******/ 						me.children.push(request);
/******/ 				} else hotCurrentParents = [moduleId];
/******/ 			}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.