gund / ng-http-interceptor

Http Interceptor library for Angular
MIT License
104 stars 16 forks source link

Not able to run application #89

Closed kharatps02 closed 7 years ago

kharatps02 commented 7 years ago

I added this feature as per given instruction but getting following error in browser .

Uncaught ReferenceError: extends is not defined at interceptable-http.js:6 at Object. (interceptable-http.js:19) at webpack_require (bootstrap b4bbcca…:52) at Object. (main.bundle.js:77524) at webpack_require (bootstrap b4bbcca…:52) at Object. (main.bundle.js:77602) at webpack_require (bootstrap b4bbcca…:52) at Object. (main.bundle.js:15364) at webpack_require__ (bootstrap b4bbcca…:52)

gund commented 7 years ago

Please make sure you have imported ts-helpers module in your app.

kharatps02 commented 7 years ago

Thanks, Its working for me now .

ghost commented 7 years ago

This is still not working for me.

Uncaught ReferenceError: extends is not defined at interceptable-http.js:6 at Object. (interceptable-http.js:19) at webpack_require (bootstrap 7fa372f…:52) at Object. (main.bundle.js:176143) at webpack_require (bootstrap 7fa372f…:52) at Object. (main.bundle.js:176086) at webpack_require (bootstrap 7fa372f…:52) at Object. (main.bundle.js:176048) at webpack_require (bootstrap 7fa372f…:52) at Object. (main.bundle.js:105538) at webpack_require (bootstrap 7fa372f…:52) at Object. (user-details.service.ts:39) at webpack_require (bootstrap 7fa372f…:52) at Object. (main.bundle.js:39279) at webpack_require__ (bootstrap 7fa372f…:52)

I have the following in tsconfig.json file

{ "compilerOptions": { "baseUrl": "", "declaration": false, "emitDecoratorMetadata": true, "experimentalDecorators": true, "lib": [ "es6", "dom" ], "mapRoot": "./", "module": "es6", "moduleResolution": "node", "outDir": "../dist/out-tsc", "sourceMap": true, "noEmitHelpers": false, "target": "es5", "typeRoots": [ "../node_modules/@types" ] } }

I have the following in package.json

"dependencies": { "@angular/common": "2.4.6", "@angular/compiler": "2.4.6", "@angular/core": "2.4.6", "@angular/forms": "2.4.6", "@angular/http": "2.4.6", "@angular/material": "^2.0.0-alpha.11-3", "@angular/platform-browser": "2.4.6", "@angular/platform-browser-dynamic": "2.4.6", "@angular/router": "3.4.6", "@ng-bootstrap/ng-bootstrap": "^1.0.0-alpha.20", "@ngrx/core": "^1.0.2", "@ngrx/effects": "^2.0.0", "@ngrx/store": "^2.1.2", "angular2-modal": "^2.0.0-beta.12", "core-js": "^2.4.1", "immutability-helper": "^2.1.1", "immutable": "^3.8.1", "jsplumb": "2.2.6", "lodash": "^4.17.4", "moment": "^2.14.1", "ng-http-interceptor": "^2.0.3", "normalizr": "^3.1.0", "reflect-metadata": "0.1.8", "rxjs": "^5.0.1", "ts-helpers": "^1.1.1", "zone.js": "^0.7.2" }, "devDependencies": { "@angular/compiler-cli": "2.4.6", "@ngrx/store-devtools": "^3.0.1", "@ngrx/store-log-monitor": "^3.0.1", "@types/jasmine": "2.5.38", "@types/node": "^6.0.42", "angular-cli": "1.0.0-beta.21", "awesome-typescript-loader": "2.2.1", "codelyzer": "~2.0.0-beta.1", "jasmine-core": "2.5.2", "jasmine-spec-reporter": "2.5.0", "karma": "1.2.0", "karma-chrome-launcher": "^2.0.0", "karma-cli": "^1.0.1", "karma-jasmine": "^1.0.2", "karma-remap-istanbul": "^0.2.1", "protractor": "4.0.9", "ts-node": "1.2.1", "tslint": "^4.4.2", "typescript": "^2.1.6", "webdriver-manager": "10.2.5" } }

I upgraded my typescript to latest version to @2.1.6 I included ts-helpers in module.

gund commented 7 years ago

Weird. I'm not sure if there is something to do with the typescript version but can you try to compile with noEmitHelpers: true option?

If that won't work could you please provide a plunkr?

Thanks

ghost commented 7 years ago

noEmitHelpers: true didn't work for me. Somehow on commenting this line //__extends(InterceptableHttp, _super); in interceptable-http.js it works as expected. Not sure if this would create any other issues. But I am able to intercept now.

gund commented 7 years ago

Hm, it's weird how it works without __extends =) Anyway it would be great if you are able to provide plunkr so I can have a look into call stacks.

Thanks

teswar commented 7 years ago

I too got the Uncaught ReferenceError: __extends is not defined error. And bypassed it as @idnesh did. image

gund commented 7 years ago

Yeah I see the error but I need a repro plunk or repo because it seems like you just did not include ts-helpers module

teswar commented 7 years ago

Stupid me. Thanks @grund that resolved it ...

gund commented 7 years ago

I'm closing this as it seems to be resolved.

parthivreddy27 commented 7 years ago

need to add ts-helpers in package.json file?

gund commented 7 years ago

If you're using v3+ - just install tslib module locally. If before v3 - yes, you should include ts-helpers yourself.