Angular2-jwt: Webpack warning: Cannot find source file 'angular2-jwt.ts':

Created on 26 Dec 2016  路  6Comments  路  Source: auth0/angular2-jwt

I've installed latest version and have this error:

WARNING in ./~/angular2-jwt/angular2-jwt.js
Cannot find source file 'angular2-jwt.ts': Error: Cannot resolve 'file' or 'directory' ./angular2-jwt.ts in node_modules/angular2-jwt

Why do you ignore *.ts files for npm ?

bug

Most helpful comment

Did you guys find a solution for that issue?

All 6 comments

Experiencing this problem too. I've used webpackMiddleware: { quiet: true } to hide this for now but this is not a solution.

In fact the problem is in the source map file not with the ignore of *.ts I think.
In angular2.jwt.js.map, replacing angular2-jwt.ts by angular2-jwt.d.ts solve the issue.

See #218 and #198 for more info.

I'm open to fixes that aren't just re-including the .ts files. Angular doesn't include them and as such we shouldn't need to either. I assume we're screwing something up somewhere with what we push to npm. Part of my plans for 1.0 is to have test projects with the major ways of building angular (webpack, system, cli, ionic) so that issues like this can be found and prevented at build time. I doubt I will resolve this one myself before then.

@escardin You are absolutely right, .ts files should not be included. If you check the PrimeNG project for Angular 2 they doesn't include .ts files, only .d.ts files like this repository and everything works fine.

The solution is to change the reference to the .ts file by the .d.ts in the sourcemap file.

I'll look at what primeNG does to do the source mapping when I work on this. Angular is a good example of what the end result should be, but imo is terrible as an example for how to do it, because their build is super complicated.

Did you guys find a solution for that issue?

Was this page helpful?
0 / 5 - 0 ratings