JSON file "Failed to compile"
See original GitHub issue- I have read the contribution documentation for this project.
- I agree to follow the code of conduct that this project follows, as appropriate.
- I have searched the issue tracker for an issue that matches the one I want to file, without success.
Please describe your issue:
I have some JSON files used for i18n in my app (using ng2-translate
). In development using electron-forge start
everything works great. After I run electron-forge make
, the app throws an (impossible to diagnose) error Unexpected token F in JSON at position 0
. Looking at DevTools’ Network
tab, I see that the en.json
file is found, but the response is the following error:
Failed to compile /Users/leifwells/Code/electron/ef-test/out/ef-test-darwin-x64/ef-test.app/Contents/Resources/app/src/www/assets/i18n/en.json: Cannot read property 'get' of null
TypeError: Cannot read property 'get' of null
at /Users/leifwells/Code/electron/ef-test/out/ef-test-darwin-x64/ef-test.app/Contents/Resources/app/node_modules/electron-compile/lib/compiler-host.js:302:34
at next (<anonymous>)
at step (/Users/leifwells/Code/electron/ef-test/out/ef-test-darwin-x64/ef-test.app/Contents/Resources/app/node_modules/electron-compile/lib/compiler-host.js:47:191)
at /Users/leifwells/Code/electron/ef-test/out/ef-test-darwin-x64/ef-test.app/Contents/Resources/app/node_modules/electron-compile/lib/compiler-host.js:47:361
Note of interest for future readers: The “F” in Unexpected token F in JSON at position 0
is the “F” in Failed to compile
.
Obviously, something has gone wrong in the compile portion of the make
process, but I am uncertain what it could be or how to avoid it. Surely other people have used JSON files have been used with Electron. 😉
Any guidance would be helpful.
Issue Analytics
- State:
- Created 7 years ago
- Comments:19 (7 by maintainers)
Top GitHub Comments
I was attempting to load the CSV through D3, but it didn’t seem to matter what I used. If the file was part of the package then the compiler would mess with it.
I was able to get around the issue by renaming the file from a .csv to a .txt. The compiler ignores it now and eventually I plan on taking input from a database rather than a file anyway.
https://github.com/Lypzis/phaserAdvanced/blob/master/src/scripts/Preloader.js running on start works fine, the problem appears after package. line 18 is where it calls a .csv.