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

Not compatible ie11 #278

Closed
beidan opened this issue Feb 22, 2020 · 9 comments
Closed

Not compatible ie11 #278

beidan opened this issue Feb 22, 2020 · 9 comments

Comments

@beidan
Copy link

beidan commented Feb 22, 2020

some code didnot transform to es5 ....

@ghost
Copy link

ghost commented Feb 24, 2020

We are having the same issue. The error reads:

Object doesn't support property or method 'repeat'

The app works in IE11, but when adding swr it crashes. Tried various polyfills without any luck.

Skjermbilde 2020-02-24 kl  10 20 16

@embeddedt
Copy link

embeddedt commented Feb 25, 2020

String.prototype.repeat is part of ES6/ES2015; you would have to add an appropriate polyfill for browsers which don't support ES6.

@ghost
Copy link

ghost commented Feb 25, 2020

I have tried to add that polypill multiple times, without any luck.

It's added at the top of the index.js and copied directly from the Mozilla code.
Skjermbilde 2020-02-25 kl  09 36 14

IE11 still gives the same error, and I have verified that the polyfill is being executed.

Skjermbilde 2020-02-25 kl  09 36 54

@beidan
Copy link
Author

beidan commented Feb 26, 2020

{
                test: /\.(js|tsx|ts)?$/,
                include: [path.join(process.cwd(), 'node_modules/swr')],
                loaders: [{
                    loader: 'babel-loader'
                }]
 }

i use babel to transform it. and it work in ie11.

@jorisre
Copy link

jorisre commented Apr 19, 2020

Hi !
Did it works for you ?
I don't have same error. I'm using swr with Next.js.
Thanks for help

@beidan I've tried your webpack config, it fail also

image (2)

@quangdng
Copy link

quangdng commented Apr 28, 2020

@joris-
Have a look at https://www.npmjs.com/package/next-transpile-modules if you are using Next.js. This helps transpile untranspiled modules in node_modules.

In your next.config.js

const withTM = require("next-transpile-modules")([
  "swr"
]);

module.exports = withTM();

@jorisre
Copy link

jorisre commented Apr 28, 2020

@joris-
Have a look at https://www.npmjs.com/package/next-transpile-modules if you are using Next.js. This helps transpile untranspiled modules in node_modules.

In your next.config.js

const withTM = require("next-transpile-modules")([
  "swr"
]);

module.exports = withTM();

Thx I'll try

@morriq
Copy link

morriq commented May 8, 2020

@beidan @joris-

This one works for me:

      {
        test: /\.(js|jsx)?$/,
        exclude: /node_modules\/(?!swr)/,
        use: {
          loader: 'babel-loader',
        },
      },

based on: babel/babel-loader#171

@shuding
Copy link
Member

shuding commented Jun 12, 2020

A fix is released in v0.2.3 :tada:

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

6 participants