You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm having the following problem. I'm developing a module for node.js which of course has it's proper package.json file with a "main" field, which is in my case
{
"main": "lib/index.js"
}
However, for some testing reasons, I want to run nw.js as well in this folder. The problem though is that I cannot simply change the "main" field to for example
{
"main": "nw/index.html"
}
as this would break all my .js files which do something like
varmylib=require('..');
where ".." resolves to the main directory of my module.
I tried to solve this by creating a separate package.json file for nw.js and put it in a sub-folder of my module and subsequently running nw from that sub-folder. This doesn't solve the issue though because as such I'm unable to refer any files in the parent directory, which is what I need:
<!-- ".." won't work when nw is run from within the subfolder. --><scripttype="text/javascript" src="../lib/index.js"></script>
I tried searching for a way to specify the manifest file explicitly so that nw.js reads in the required data from there, and not from the default package.json. This would allow me to create a new manifest file, called for example package-nw.json that would live happily next to the node module's package.json file, and then launch nw.js from the main directory as (something like)
nw . --manifest=package-nw.json
I found that a command line --nwapp already exists, but that doesn't seem to allow me to specify my manifest file, only the app directory. I need to specify my manifest file instead.
I know that I could solve this by creating a dedicated package.json file in a build process, but I just want to play around with nw.js during development of my node module. I don't need it for production. Therefore, in my opinion, a feature to specify the manifest file explicitly would be useful.
I'm running nw.js 0.23.4 on Windows 7, but this isn't going to matter too much I guess as the problem is pretty general.
The text was updated successfully, but these errors were encountered:
I had exactly the same issue yesterday, but I worked around this by doing the reverse you did.
I created a subfolder containing all node.js code called "bin", then in that bin folder is a package.json for node.js. The node_modules folder remains in the root. Then in the project root folder there is an index.html, package.json (contain all node.js info, but the main tag is for nw.js) and a run.js file. This run.js file just has a line "require("bin/index.js"). This allows you to start the app from node using the following command: node ./run.js. If you then set the execute flag for the run.js file and add a shell shim on the first line of run.js (), then you can even do this on the command: "./run.js". Not the ideal world scenario, but works for me.
2024: Found this issue today. I'm working around it. Is there a flag that for this that I haven't found?
eg: nw ./src/index.html --manifest="path-to-package.json"
Hi,
I'm having the following problem. I'm developing a module for node.js which of course has it's proper package.json file with a "main" field, which is in my case
However, for some testing reasons, I want to run nw.js as well in this folder. The problem though is that I cannot simply change the "main" field to for example
as this would break all my .js files which do something like
where ".." resolves to the main directory of my module.
I tried to solve this by creating a separate package.json file for nw.js and put it in a sub-folder of my module and subsequently running nw from that sub-folder. This doesn't solve the issue though because as such I'm unable to refer any files in the parent directory, which is what I need:
I tried searching for a way to specify the manifest file explicitly so that nw.js reads in the required data from there, and not from the default package.json. This would allow me to create a new manifest file, called for example package-nw.json that would live happily next to the node module's package.json file, and then launch nw.js from the main directory as (something like)
nw . --manifest=package-nw.json
I found that a command line --nwapp already exists, but that doesn't seem to allow me to specify my manifest file, only the app directory. I need to specify my manifest file instead.
I know that I could solve this by creating a dedicated package.json file in a build process, but I just want to play around with nw.js during development of my node module. I don't need it for production. Therefore, in my opinion, a feature to specify the manifest file explicitly would be useful.
I'm running nw.js 0.23.4 on Windows 7, but this isn't going to matter too much I guess as the problem is pretty general.
The text was updated successfully, but these errors were encountered: