Compile Angular application with nwjc

423 views
Skip to first unread message

mickael...@gmail.com

unread,
Feb 28, 2015, 2:14:12 PM2/28/15
to nwjs-g...@googlegroups.com
Hello,
I'm currently testing nw.js 12.0 and I have difficulties to compile my script.js file containing my angular front-end application.

The content of my script.js file :

var app = angular.module('appName', []);


app
.controller(...);


app
.directive(...);


app
.factory(...);


[...]

So i compiled it like this : nwjc.exe script.js data.bin
No errors appeared.

But when I launch the application, i have an error in my console : 
TypeError: Cannot read property 'localStorage' of undefined

This localStorage property comes from the first declared variable in my interceptorService :
var jwt = $window.localStorage.getItem('jwt');
(so maybe the first $window used in the application at start...)

I know when we use nwsnapshot we can't compile code with undefined variables inside the file, but is it the same for nwjc ? (my only undefined variable would be 'angular').

Thank you.

Sander

unread,
Mar 27, 2015, 8:59:28 AM3/27/15
to nwjs-g...@googlegroups.com, mickael...@gmail.com
Hello,

I have the same problem. I've tried many approaches but no solution. Did you manage to get it to work?

Thanks.
Sander
Reply all
Reply to author
Forward
0 new messages