question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incompatibility with angular 10

See original GitHub issue

You want to:

  • report a bug
  • request a feature

Current behaviour

Error in console after upgrading to Angular 10. It says TypeError: Cannot assign to read only property 'exports' of object '#<Object>'. Errors goes deep to debug dependency.

Downgrading to version 1.7.4 helps. Downgrading within version 2 doesn’t help.

Steps to reproduce

  • Having angular 9 app with installed socket.io-client. Everything works ok.
  • Upgrade angular to version 10.
  • Get an error in console. Page in browser is blank.

Expected behaviour

Everything should work as it worked before in angular 9.

Setup

  • OS: Ubuntu 20.04
  • browser: Chromium 83.0.4103.61
  • socket.io-client version: 2.0.0 - 2.3.0 affected, 1.7.4 works ok

Minimal reproduce example

https://stackblitz.com/edit/angular-ivy-qzhmby?file=package.json

I’m facing another issue here (Import error, can't find file: ./common), but I believe they have the same root, because downgrading to 1.7.4 also helps.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:8
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

7reactions
alcfeohcommented, Jul 1, 2020

+1, I have that same problem. This has to do with CommonJS exports syntax vs ES Modules syntax (as explained here: https://flaviocopes.com/cannot-assign-readonly-property-export/). Any chance socket.io could use the modern ES Modules syntax?

2reactions
depyronickcommented, Jul 10, 2020

@jeremylcarter nvm about it, its hard to maintain.

instead i added socket.io.js which socket.io server provides like at https://domain.ltd/socket.io/socket.io.js to index.html and put declare var io; to the place i had to import socket.io-client.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Incompatible peer dependency (using ng update @angular ...
In most SO cases, people have suggested running the update with the --force flag. Is the correct way to update codelyzer first? Then...
Read more >
ng upgrade: incompatible peer dependency error prevents ...
Try upgrading the Angular dependencies, using for instance ng update @angular/core . I already performed the @angular/cli upgrade command which ...
Read more >
Upgrade Angular App to latest version - Medium
If you are still using older version of Angular like 8, 9 here is the complete guide to upgrade your Angular app to...
Read more >
Guide to update your Angular application v6.0 -> v12.0 for ...
Update to the new version ... Review these changes and perform the actions to update your application. If you use the Angular Service...
Read more >
Creating libraries - Angular
Ensuring library version compatibilitylink ... The Angular version used to build an application should always be the same or greater than the Angular...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found