I am trying to upgrade my application from angular 2 to angular 5.I have updated all the dependencies and everything is building fine.But, ngx-cookie-service library is creating issues when I am trying to run my application.
In app.module.ts, I am importing the cookieservice and adding to providers array.
import { CookieService } from 'ngx-cookie-service';
providers: [ CookieService, ApiService, {provide: LocationStrategy, useClass: HashLocationStrategy} ]
In my api.service.ts,
import { CookieService } from 'ngx-cookie-service';
In constructor, I am instantiating it
constructor(private http: HttpClient,
private _cookieService:CookiesService,
private router: Router) {}
I am using webpack to build and while running my application, I am getting this error
VM2645:1 Uncaught SyntaxError: Unexpected token export
at Object.48 (app.a4460e7c733950106cd8.js:formatted:9)
at __webpack_require__ (polyfills.89065a9ec9d93329d461.js:1)
at eval (eval at 47 (app.a4460e7c733950106cd8.js:formatted:6), <anonymous>:11:17)
at Object.47 (app.a4460e7c733950106cd8.js:formatted:6)
at __webpack_require__ (polyfills.89065a9ec9d93329d461.js:1)
at Object.eval (eval at 0 (app.a4460e7c733950106cd8.js:formatted:3), <anonymous>:5:20)
at eval (eval at 0 (app.a4460e7c733950106cd8.js:formatted:3), <anonymous>:11:30)
at Object.0 (app.a4460e7c733950106cd8.js:formatted:3)
at __webpack_require__ (polyfills.89065a9ec9d93329d461.js:1)
at window.webpackJsonp (polyfills.89065a9ec9d93329d461.js:1)
at app.a4460e7c733950106cd8.js:formatted:1
Error it is highlighting it is,
function(module, exports) {
eval("export * from './cookie-service/cookie.service';\n//# sourceMappingURL=index.js.map//# sourceMappingURL=data:application/json;charset=utf-8;base64")
},
I am aware it is not much to debug, still if someone else has faced this issue can help.
Probably just a spelling mistake in api.service.ts. Its not "CookiesService", its "CookieService"