Using immer with IE11

Asked
Active3 hr before
Viewed126 times

7 Answers

using
90%

This means you are using a feature you didn't enable first. For example to use Immer on IE 11 ES5 support has to be enabled. See https://immerjs.github.io/immer/docs/installation#pick-your-immer-version for details.,Is there a work around to get produce from "immer" to work on IE11?, Is it safe to screw into a single support beam holding up an entire house?

Pretag
 Pretag team - issue, fix, solve, resolve
88%

tried with setAutoFreeze(false), still the same error in IE11 :(,It's a big legacy application so I am using immer only for new features, so it is used only in 3 reducers. When I rewire produce from immer like this in all 3 reducers:,Using setAutoFreeze(false) stops this error.

import {
   enableES5
} from "immer"
enableES5()
load more v
72%

If your application needs to be able to run on older JavaScript environments, such as Internet Explorer or React Native, enable this feature.,I'm still getting "Object.isFrozen: argument is not an object" error in console.,Based on documentation I don't understand - how to make it work in IE11?

import {
   enableES5
} from "immer"
enableES5()
65%

Immer can be installed as a direct dependency, and will work in any ES5 environment:,To make sure Immer is as small as possible, features that are not required by every project has been made opt-in, and have to be enabled explicitly. This ensures that when bundling your application for production, unused features don't take any space.,Since version 6, support for the fallback implementation has to be explicitly enabled by calling enableES5().

Pretag
 Pretag team - issue, fix, solve, resolve
75%

If you came here with immer (redux reducers states) issues:,To stop the errors and get a default create-react-app React application working in IE 11:,Create your basic application with npx create-react-app [AppName]

import 'react-app-polyfill/ie11';
import 'react-app-polyfill/stable';
import 'fast-text-encoding/text';
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';

ReactDOM.render(
<App />, document.getElementById('root'));
load more v
40%

Supporting Map or Set within your state,Create React App IE11 Support Example,Polyfilling Proxy Create React App IE11 Support Example

addTodo: action((state, payload) => {
   // Mutating the state directly! 🤯
   //           👇
   state.items.push(payload);
});
load more v
22%

Contact ,There is another question to ask yourself - ,The process is split into a few steps:

{
   "presets": [
      [
         "@babel/preset-env",
         {
            "useBuiltIns": "entry"
         }
      ]
   ]
}
load more v

Other "using-undefined" queries related to "Using immer with IE11"