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

IE9+ not supported since 4.3.5 because of loupe #53

Closed
marian-r opened this issue Feb 1, 2022 · 4 comments · Fixed by #54 or #55
Closed

IE9+ not supported since 4.3.5 because of loupe #53

marian-r opened this issue Feb 1, 2022 · 4 comments · Fixed by #54 or #55
Labels

Comments

@marian-r
Copy link
Contributor

marian-r commented Feb 1, 2022

The official website says Chai supports IE version 9 and above, however out tests started to fail in IE after upgrading Chai to version 4.3.5 or 4.3.6. Tests in IE throw a "Syntax Error" inside loupe. Would it be possible to remove this dependency or shall I rather open an issue against loupe to fix IE support?

Workaround: Downgrade Chai to 4.3.4.

@keithamus
Copy link
Member

Thanks for reporting @marian-r. I've transferred this to loupe. If you could please provide more information that would be helpful.

@keithamus keithamus transferred this issue from chaijs/chai Feb 1, 2022
@marian-r
Copy link
Contributor Author

marian-r commented Feb 2, 2022

I have been digging into thee details of the issue and I have a feeling the cause is the following. When Chai requires the loupe library the es-module-aware tools (Webpack in my case) look at the package.json. Because loupe defines module property in package.json that takes precedence over the main property. It means the source files of loupe will get loaded in the browser. And because source files contain modern ES5+ syntax older browsers like IE throw errors.

There is a possible workaround for Webpack to let it look at the main property first:

resolve: {
  byDependency: {
    commonjs: {
      mainFields: ['browser', 'main']
    }
  }
}

However, it would be good to fix this in loupe in order for Chai to support older browsers out of the box. It could be fixed by setting browser field in package.json to the same value as main. I will prepare a PR for this.

@github-actions
Copy link

github-actions bot commented Feb 2, 2022

🎉 This issue has been resolved in version 2.3.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions
Copy link

github-actions bot commented Feb 5, 2022

🎉 This issue has been resolved in version 2.3.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

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