Incompatibility with angular 10
See original GitHub issueYou 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:
- Created 3 years ago
- Reactions:8
- Comments:12 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
+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?
@jeremylcarter nvm about it, its hard to maintain.
instead i added
socket.io.js
which socket.io server provides like athttps://domain.ltd/socket.io/socket.io.js
to index.html and putdeclare var io;
to the place i had to import socket.io-client.