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

Broken IE 11 loading because of wrong "main" value in package.json #1349

Closed
1 of 2 tasks
hyperknot opened this issue Feb 20, 2020 · 6 comments
Closed
1 of 2 tasks

Broken IE 11 loading because of wrong "main" value in package.json #1349

hyperknot opened this issue Feb 20, 2020 · 6 comments
Milestone

Comments

@hyperknot
Copy link

You want to:

  • report a bug
  • request a feature

Current behaviour

What is actually happening?

Following the official example of using:

import io from 'socket.io-client';

in a JS app results in a broken site in IE 11.

By broken I don't mean the socket-io functionality doesn't work, but that it breaks loading the whole web app's bundle, including error reporting etc. Because no one tests on IE 11 probably no one really noticed this bug.

Steps to reproduce (if the current behaviour is a bug)

Just add import io from 'socket.io-client' in a web app and test in IE 11.

Expected behaviour

What is expected?

IE 11 should load the bundle

Setup

  • OS: Win 10
  • browser: IE 11
  • socket.io version:

Other information (e.g. stacktraces, related issues, suggestions how to fix)

The reason this is happening is because the "main" value in package.json specifies the unbundled source code, not the bundled dist folder, thus the source code gets bundled. Probably some bundlers also process the imported modules, but my version of Webpack doesn't, it only processes user's source code.

The solution would be very simple, to specify one of the dist files as the "main" value.

As a workaround I am using this line, which works:

import io from 'socket.io-client/dist/socket.io.slim.js'
@olingern
Copy link

Have this same problem. The workaround works for me 👍

@Runedia
Copy link

Runedia commented Feb 21, 2020

Good!

@kand
Copy link

kand commented Feb 26, 2020

Workaround works for me as well, thanks!

@neelmshah
Copy link

neelmshah commented Mar 19, 2020

It works for me as well, Good Job. thanks @hyperknot!!

@ease
Copy link

ease commented Jun 9, 2020

So that others know, here it is in console:
image

@darrachequesne
Copy link
Member

The debug dependency was reverted to 3.1.0, which does not need to be transpiled. Released in 2.3.1.

Please note that you can also use the webpack-remove-debug plugin, in order to remove any call to the debug dependency (until we find a proper way to provide a build with and without debug).

@darrachequesne darrachequesne added this to the 2.3.1 milestone Sep 30, 2020
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

7 participants