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

Add "browser" field to the package.json #26

Closed
wants to merge 1 commit into from

Conversation

yuezk
Copy link

@yuezk yuezk commented Jun 21, 2019

When bundling the Swiper module using Webpack, the bundled js will cause a Syntax error in IE 11.

The reason is that Webpack will use the "module" field (since the default value of mainFields defined in Webpack is ["browser", "module", "main"] ) as the entry point of Swiper.

As the class syntax inside the "module" entry point was not transpiled and then was bundled into the target js files, which will cause the Syntax error in IE 11, because IE 11 doesn't support the class syntax.

The relevant issue is #21

When bundling the Swiper module using Webpack, the bundled js will cause a Syntax error in IE 11.

The reason is that Webpack will use the "module" field (since the default value of mainFields defined in Webpack is ["browser", "module", "main"] ) as the entry point of Swiper.

As the class syntax inside the "module" entry point was not transpiled and then was bundled into the target js files, which will cause the Syntax error in IE 11, because IE 11 doesn't support the class syntax.
@chungwong
Copy link

I found the same issue too and can see the whole Dom7 class in IE 11 which is 100% breaking.

@Riccardo-Andreatta
Copy link

Riccardo-Andreatta commented Sep 17, 2019

I have the same issue.
So, how can I fix this problem in my project?
Do I need to wait for this PR to be merged in?
It is open since June, are there any other issue?

@Riccardo-Andreatta
Copy link

Riccardo-Andreatta commented Sep 20, 2019

@nolimits4web After forking both the "Swiper" and the "Dom7" and referencing them in my Angular project, instead of these libraries via npm, I can confirm that this fix is the one that is avoiding the Syntax error on IE11.

If you are not merging this PR, we will keep our own repositories with the fix as reference in our package.json and keep them updated when there will be other new releases from you.

@yuezk
Copy link
Author

yuezk commented Sep 20, 2019

Another PR I made for Swiper is nolimits4web/swiper#3110, but it was closed.

I think this PR won’t break any thing, because this only affect which js file is bundled, and the file used by the browser field is compatible with the file used by the module field. So I think it's safe to ship both PRs.

@Riccardo-Andreatta
Copy link

Riccardo-Andreatta commented Jan 29, 2020

Any update about this @nolimits4web ? As I understand you may consider IE11 as an old browser and may not support it, this is just a little change that is making it works correctly also in this browser.
IE11, even if it is a deprecated web browser, is still used by hundred of thousands of people all around the world.

@tsirilson
Copy link

Zero response. Absurd.

@nolimits4web
Copy link
Owner

Closing as Dom7 does not mean to support IE 11

Repository owner locked and limited conversation to collaborators Feb 15, 2021
@yuezk yuezk deleted the patch-1 branch February 18, 2021 08:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants