-
Notifications
You must be signed in to change notification settings - Fork 298
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
Loading of ng-package.json fails due to UTF-8 signature #87
Comments
Hi @Dastardl, what do you mean by "signature"? A byte order mask (BOM)? I had a similar issue w/ webpack once webpack/enhanced-resolve#87 and then we (the people at my employer) decided that we just do not use BOMs and all is good :) Let's keep the issue noticed but I'll priorize it low. |
@dherges Correct, Visual studio just calls it "UTF-8 with signature", my mistake. Unfortunately this is the default format VS saves files in, so a good couple of people will be suprised when this package fails on even the most basic app (which is a bummer because it works really well!). Would you consider using something like read-file? It basically just wraps the fs.readfile methods to remove the BOM when the encodigng is UTF-8. What i forgot in my initial post is the actual error you get. I'll post it below for the avid googler.
|
Yes why not! I just don't know when I have time for it ... I need to see. If you like to open a pull request, that's also good! |
@dherges Just tested it with the lastest version and it is working like a charm! |
This issue has been automatically locked due to inactivity. |
Inside lib\steps\json.js the following line fails :
resolve(JSON.parse(data));
whenever the file is saved as UTF-8 with a signature. This becausefs.readFile
returns a buffer instead of a string in that case.This crashes creating the package whenever the ng-package.json was created by (for example) Visual Studio 2017. The workaround is saving this file as UTF-8 without signature every time it is modified, but this makes for a poor user experience :)
This was tested with Node v6.11.1
The text was updated successfully, but these errors were encountered: