-
Notifications
You must be signed in to change notification settings - Fork 3k
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
TypeError: __extends is not a function #2177
Comments
I am also having the same issue Uncaught TypeError: __extends is not a function(…) Rx.js:345
(anonymous function) @ Rx.js:345
(anonymous function) @ Rx.js:356
execCb @ require.min.js:1
check @ require.min.js:1enable @ require.min.js:1
init @ require.min.js:1callGetModule @ require.min.js:1
completeLoad @ require.min.js:1onScriptLoad @ require.min.js:1 Using latest version from npm, almost vanilla app, no ui frameworks etc apart from jquery so far.. My Version installed from
|
Hmm... this seems like some strange SystemJS thing. That @robwormald, have you seen this with SystemJS in the past? FWIW, I use the bundled version from |
@timfogarty1549 or @nmors do either of you have a minimum example you can share to help us debug this issue? |
digging through the rc5 system bundle, it all looks OK to me. @timfogarty1549 w/ angular2 i'd strongly suggest using a bundler rather than the bundles Rx provides. |
I'm also having the same issue. |
I'm seeing this same error on my Angular2, luckily I'm getting it while running Karma and not at runtime. Any ideas on how to fix this? Angular2 2.3.1
I'm loading up the rxjs bundles through /rxjs/bundles/Rx.js into my karma.conf.js
in my systemJS config file, I have: |
Anyone experiencing this issue, would you mind to add bit more details?
|
@kwonoj I am loading the global |
I created a plnkr where the issue is available: |
I was trying to switch from rxjs-es to @reacitvex/rxjs and ran into this error when I pointed my files at the dist/es6 files directly. I had assumed that those files would be completely written in es6 and fit in nicely with our current es6 modules, but found that the files only used es6-style modules without the body of those modules being transpiled to es6. It seems that this __extends function comes with the cjs-style module system somehow, and that in mixing the es5 code body with es6 modules, the _extend function was stranded in there. Then I noticed the npm script: notice -target ES5 and --lib es5 So I know how to fix it, but it's quite inconvenient for my automated build system to have to cd into node_modules, hit npm install for this library, change the package.json, then run the modified compile_module_es6 script. Either that or I just put the modified files in my local npm repo and point to that in my projects. Or... someone can fix the script and check in the new files and upload them to npm. I would be happy to check in a fix for the npm scripts, but I don't know what procedure you use for updating your npm version. |
@dtniland uh..actually @reactivex/rxjs should not include There are some histories of native ES2015 module and final conclusion is release version of RxJS does not publish es6 package as well, So in your case, I'd like to suggest to use cjs / global under @ReactiveX package or directly install cjs via |
@kwonoj ... it seems there was an accidental publish. Obviously my fault. We're not cleaning out the |
@Blesh will RxJS 5 continue to support AMD? |
@edobry the bundled output is UMD so it will work with AMD, yes. |
Why would you not publish es6 modules? Telling everyone to use cjs seems a bit 2014 of you... not everyone wants to transpile from typescript, either. Is there a discussion on this somewhere? I thought you guys were all gung-ho on es6. At least you were last year. Did those guys leave the team? |
@trxcllnt thanks. Very illuminating. I didn't realize I was in such a minority. Well, for the time being I'll have to run the tsc script myself and use my private npm repo. Oh well, rxjs is still better than bacon. |
@dtniland Sorry about any ergonomic pain it's causing you, but we don't want to publish the wrong thing and then break a bunch of people down the road. |
|
@imcotton Thx if your ticket resolve this bug. |
Guys I've been trying to setup a basic project using SystemJS@0.19.41, RxJS5@5.0.3 and Typescript@2.1.4 and I'm getting this very same error as you'll see if you don't mind to take a look on this repo I created to share the issue with you. https://github.com/n370/systemjs-rxjs5-typescript2-boilerplate/tree/not-working Fire it up with I appreciate any help. |
I upgraded my rxjs from 5.0.0-rc 5 to 5.0.3 and got this same issue. I was using According to the readme file:
import Rx from 'rxjs/Rx'; So I changed my code to this: Working fine now. |
I can reproduce this issue as well, but using requirejs. |
The definition of You can hit the issue if you're loading the rxjs bundle with SystemJS because of // tslib.js
(function (factory) {
...
if (typeof define === "function" && define.amd) {
define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); });
}
... In case of SystemJS included into the page, // Previous definitions of the helpers
window.__extends = ...;
... // Rx.js bundle, wrapped by IIFE by SystemJS
(function (System, ..) {
var __extends;
//...
var UnsubscriptionError = (function (_super) {
// _extends === undefined, because of hoisting
__extends(UnsubscriptionError, _super);
function UnsubscriptionError(errors) {
...
}(System, ...)); If you use SystemJS v0.19.28 and include reference to This doesn't seem like an issue in rxjs, maybe PS: SystemJS v0.19.28 works because it still hasn't introduced this change. |
Amazing @mgechev! It works perfectly now. |
Hi @mgechev , Thank you for your information but it just fixed half of the problem. I am trying to use AngularJS 2.4.3. The version of System.js and Rxjs are 0.19.40 and 5.0.3. Before referencing the tslib.js in the index file, it popped up two error. One is regular error and the other one is ZoneAwareError. After referencing the tslib.js, the first one disappeared. However the second one is still there. Like this:
It's pretty annoying because I tried switch system.js back to 0.19.28 but it didn't work. It seems like the AngularJS 2.4.3 is using something new in the Rxjs. I just don't know what next can I do. Switch back to earlier version of the AngularJS2 to user earlier version of Rxjs? Thanks at lot. P.S.: If you are using Edge to debug it. It will show a completely different error like this:
(Man! I am so missing the good old desktop development environment. You don't have to figure out WTH they are doing. Yes, I know there was a stage called DLL hell but they are no longer an issue I think. |
Show me your systemjs.config.js file. |
@xonuzofa Here's my config: Please note:
)
|
Try this:
Call it from index.html or whatever like so before your boot:
|
I am using RequireJS + TypeScript + RxJS5 and I got this issue it seems to be solved by using a shim with RequireJS which loads tslib before loading rxjs: shim: {
'rxjs':{
deps: ['tslib']
}
} tslib is here: https://github.com/Microsoft/tslib |
Hi @xonuzofa , Thanks but It doesn't help. With your config, it complained that the angular's js files were not found before I changed my file structure. After fixing the file structure, it complained the lots of 404s from the RxJs library just like it were not a bundle but actually it is. And that's why I changed it to use the following config according to a post which I can't find out anymore.
And by reading the config, there is not much difference between my original config. The only change is use a piece of javascript to change the packages to "bundles/"+"original package". Can you explain why you think your solution would work? Maybe I can get some idea about how to fix it. :) Cheers |
I feel like you either don't have the same version of rxjs as me or you didn't install it the same. Did you use npm to install the packages? In my package.json I have "rxjs": "5.0.3" and using npm install I get a node_modules/rxjs folder, which does not contain a rx.js. My Rx.js file in node_modules/rxjs/Rx.js is as follows:
It seems to me that you are not using the correct file to link, thus cannot find any of the files that you need. Another issue you may be having is not moving the entire folder over to my wwwroot folder which is where all my compiled js/html/css files are, as well as lib, yours is libs.
Let me know what you are using for your link file. |
Hi @xonuzofa , My rxjs is installed via npm and the rx.js is copied from bundle folder. So, you mean I have to preserve the exact folder structure like lib/rxjs/bundle/rx.js, not just lib/rxjs/rx.js? Well, the folder structure was like that since I tried the angularjs2 beta maybe 8. It worked fine until the RTM of the angular JS. In your gulp file, it seems like you copied everything of the rxjs. And you are not using the bundle of the rxjs, aren't you? I can try that but I hope I can just use bundle to reduce the connection amount. I thought the current issue has nothing to do with the css or html. My problem is that it's throwing error when trying to use the rxjs bundles with angularjs 2, just in case I am not making it clear.
And what do you mean by "does not contain a rx.js"? I am confused with the next line saying "My Rx.js file in node_modules/rxjs/Rx.js is as follows". I checked the node_modules/rxjs and there is a rx.js but it is not the bundles version. Thanks |
Yes i used to use the rx file inside the bundle but it did not work after the update either. So i switched it to the Rx.js file on the root folder and it worked for me. But yes, it will require you to move the entire rxjs folder or edit the file as needed. |
Just want to remind since #2121 has landed with v5.1 release, this problem should been resolved, please upgrade your rxjs version and try. |
As fix for this is released and believe latest version resolve it, closing issue. If it still occurs please feel freely report / reopen. |
I am using rxjs v5.3.0, and I am still hitting this exception with angular 4.0.2 |
@mertdeg would you mind to share minimal reproducible repo for issue? it'll help to look into issues. |
@kwonoj Nevermind, I think i was using rxjs-es npm package, which seems to be deprecated |
I have updated to version 5.3.1 and the problem was solved. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I have an angular 2 app that works fine with 5.0.0-rc.1 but fails to load with 5.0.0-rc.2 thru 5. The error in the console (line numbers for rc.5) is
home:40 Error: (SystemJS) __extends is not a function
TypeError: __extends is not a function
at eval (http://localhost:3000/node_modules/rxjs/bundles/Rx.js:345:5)
at Object.eval (http://localhost:3000/node_modules/rxjs/bundles/Rx.js:356:2)
at ZoneDelegate.invoke (http://localhost:3000/node_modules/zone.js/dist/zone.js:229:26)
at Zone.run (http://localhost:3000/node_modules/zone.js/dist/zone.js:113:43)
at http://localhost:3000/node_modules/zone.js/dist/zone.js:509:57
at ZoneDelegate.invokeTask (http://localhost:3000/node_modules/zone.js/dist/zone.js:262:35)
at Zone.runTask (http://localhost:3000/node_modules/zone.js/dist/zone.js:151:47)
at drainMicroTaskQueue (http://localhost:3000/node_modules/zone.js/dist/zone.js:405:35)
at XMLHttpRequest.ZoneTask.invoke (http://localhost:3000/node_modules/zone.js/dist/zone.js:336:25)
Error loading http://localhost:3000/main
at eval (http://localhost:3000/node_modules/rxjs/bundles/Rx.js:345:5)
at Object.eval (http://localhost:3000/node_modules/rxjs/bundles/Rx.js:356:2)
at ZoneDelegate.invoke (http://localhost:3000/node_modules/zone.js/dist/zone.js:229:26)
at Zone.run (http://localhost:3000/node_modules/zone.js/dist/zone.js:113:43)
at http://localhost:3000/node_modules/zone.js/dist/zone.js:509:57
at ZoneDelegate.invokeTask (http://localhost:3000/node_modules/zone.js/dist/zone.js:262:35)
at Zone.runTask (http://localhost:3000/node_modules/zone.js/dist/zone.js:151:47)
at drainMicroTaskQueue (http://localhost:3000/node_modules/zone.js/dist/zone.js:405:35)
at XMLHttpRequest.ZoneTask.invoke (http://localhost:3000/node_modules/zone.js/dist/zone.js:336:25)
Error loading http://localhost:3000/main
The text was updated successfully, but these errors were encountered: