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

IE 11 compatibility #130

Closed
pavelekNET opened this issue Sep 12, 2019 · 4 comments
Closed

IE 11 compatibility #130

pavelekNET opened this issue Sep 12, 2019 · 4 comments
Assignees

Comments

@pavelekNET
Copy link

Describe the bug
In IE 11 file morphism.js throws "Invalid syntax (1,1715)"

To Reproduce
Steps to reproduce the behavior:

  1. reference <script src="https://unpkg.com/morphism/dist/morphism.js"></script>
  2. Open in IE 11

Expected behavior
Work like in other browsers

Additional context
If possible could you specify at least polyfills that are required for this library? I found out that its used: Promise, Map

Many thanks

@pavelekNET pavelekNET changed the title IE 11 compatability IE 11 compatibility Sep 12, 2019
@priithansen
Copy link

priithansen commented Sep 17, 2019

There are also arrow functions in dist build that IE doesn't support

@emyann
Copy link
Member

emyann commented Sep 17, 2019

Thank you guys for digging this issue! I'm gonna work on a PR by the end of the week, when I'll be able to test on IE11.

@priithansen
Copy link

I was able to produce a IE compatible build with:

npm i --save-dev @babel/plugin-transform-runtime
npm i --save-dev @babel/runtime

and modifing the .babelrc file so:

{
  "presets": [
    [
      "@babel/preset-env",
      {
        "targets": {
          "node": "current",
          "esmodules": true,
          "ie": "11", // Added !
        }
      }
    ],
    "@babel/typescript"
  ],
  "plugins": [
    ["@babel/plugin-proposal-decorators", { "legacy": true }],
    ["@babel/proposal-class-properties", { "loose": true }],
    "@babel/proposal-object-rest-spread",
    "@babel/plugin-transform-runtime" // Added !
  ]
}

But this result still needs unspecified polyfills (ex: Symbol) and will not work if transpiled again on import by the consumer script. Also the file size will end up ~2x the original size.

Can't speak for other people but for my use case it would make most sense if the npm install of morphism would include js source so that I could import and tell webpack to transpile it and use whichever polyfills or targets are specified for the whole project.

@emyann emyann self-assigned this Oct 3, 2019
@sisp
Copy link

sisp commented Oct 6, 2019

@emyann Have you considered using TSDX for zero-config build/test setup? It follows the spirit of Facebook's Create React App but for (Typescript) libraries instead of React apps. Many great projects like Formik, mobx-keystone, mobx-react-lite, etc. are using it and my personal experience has been great, too. It takes care of many peculiarities out of the box and is easily extensible if needed. Perhaps it also helps with IE11 compatibility?

@emyann emyann mentioned this issue Oct 9, 2019
7 tasks
@emyann emyann closed this as completed May 13, 2020
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

4 participants