Comments (7)
please use the name "node-main" in the manifest for this.
from nw.js.
It would be nice to have a javascript entry point that would create the first window. This would allow for things like jade and stylus templates that are rendered at run time.
from nw.js.
Most template engines can be used at browser side, for Jade have a look at https://github.com/zcbenz/nw-file-explorer/blob/master/node_modules/folder_view.js
For stylus things are the same, compile it at runtime and then manually add compiled CSS into DOM.
from nw.js.
I see what your saying. Treat it more like a single page app and then dynamically add everything to the html page. Your making me think a little further outside the box. I have been using jake to compile my jade/stylus and run node-webkit or build an exe.
from nw.js.
didn't fix fully, reopen.
from nw.js.
How would you open a window from the node-main
script?
var gui = require('nw.gui');
var win = gui.Window.open('https://github.com', {
position: 'center',
width: 901,
height: 127
});
The node-main
directive in my package.json
points at the above file, but crashes with the following error:
module.js:343
throw err;
^
Error: Cannot find module 'nw.gui'
at Function.Module._resolveFilename (module.js:341:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:367:17)
at require (module.js:383:17)
at Object.<anonymous> (/home/yelvert/projects/jengine-builder/index.js:1:69)
at Module._compile (module.js:459:26)
at Object.Module._extensions..js (module.js:477:10)
at Module.load (module.js:359:32)
at Function.Module._load (module.js:315:12)
at Module.runMain (module.js:500:10)
from nw.js.
I see now why the require('nw.gui')
doesn't work, as it only works in the browser because your overwriting the browsers require to do something special for the nw.gui
module. My next stop was to try requiring the nw executable that is used to run the app. require('./bin/linux/x86_64/nw')
. Doing that produced the following error:
/home/yelvert/projects/jengine-builder/bin/linux/x86_64/nw:1
(function (exports, require, module, __filename, __dirname) { �ELF���
^
SyntaxError: Unexpected token ILLEGAL
at Module._compile (module.js:442:25)
at Object.Module._extensions..js (module.js:477:10)
at Module.load (module.js:359:32)
at Function.Module._load (module.js:315:12)
at Module.require (module.js:367:17)
at require (module.js:383:17)
at Object.<anonymous> (/home/yelvert/projects/jengine-builder/index.js:1:86)
at Module._compile (module.js:459:26)
at Object.Module._extensions..js (module.js:477:10)
at Module.load (module.js:359:32)
using require('./bin/linux/x86_64/nw.pak')
produced almost the same error:
/home/yelvert/projects/jengine-builder/bin/linux/x86_64/nw.pak:1
(function (exports, require, module, __filename, __dirname) { �
^
SyntaxError: Unexpected token ILLEGAL
at Module._compile (module.js:442:25)
at Object.Module._extensions..js (module.js:477:10)
at Module.load (module.js:359:32)
at Function.Module._load (module.js:315:12)
at Module.require (module.js:367:17)
at require (module.js:383:17)
at Object.<anonymous> (/home/yelvert/projects/jengine-builder/index.js:1:86)
at Module._compile (module.js:459:26)
at Object.Module._extensions..js (module.js:477:10)
at Module.load (module.js:359:32)
from nw.js.
Related Issues (20)
- Building NW54 on macOS Ventura fails at LINK ./v8_context_snapshot_generator
- Message missing from `postMessage()` when using `file:` URL for window
- NW.js0.75.0 debug build fails on Windows
- win.window undefined with cross origin isolation headers
- IsolatedSandboxedIframe doesn't work at nw.js HOT 2
- process.unhandleRejection event never be fired
- nw.js crashes from 0.67.0 to 0.75.0 when using v8.setFlagsFromString() HOT 4
- nwjs-v0.76.0-linux-ia32 fails on Debian 11 i686 Kernel 5.10.178-3 (2023-04-22) HOT 8
- Nwjs icon picture changes if the user "Click on pin to TaskBar" first and then "Click on unpin from TaskBar"
- --mixed-context crash on refresh ^0.76.1 HOT 1
- Versions v0.73.0, v0.74.0, v0.75.0, v0.75.1, v0.76.0, and v0.76.1 of "nwjs-v0.##.#-linux-x64" All Crash and Fail On Linux
- drag file to the desktop
- NWJS not supported for Mac M1? HOT 1
- Cloudflare can distinguish between NW.js and Chromium from <webview> HOT 3
- URL.createObjectURL fails on 0.76.1 HOT 2
- Certificate expired error HOT 1
- nw.js apps crash when a tray icon is used before a window has been created.
- Having nw.Window.get().evalNWBin inside a compiled js file (bin) crashes the app (only on normal flavor)
- "Mainfest file missing or unreadable" in barebones project HOT 2
- `webkitSpeechRecognition` always throws a network error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nw.js.