-
Notifications
You must be signed in to change notification settings - Fork 302
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
No support for CommonJS #696
Comments
I just encountered this myself and was annoyed that CJS wasn't supported (especially since NW.js doesn't support ESM for the That said @indexofrefraction, you can simply name your build script with the Additionally, I do have this working, so you should log your error to see what the problem is: nwbuild(settings).then(function () {
console.log("Promise Resolved");
}).catch(function (error) {
console.log("Promise Rejected", error);
}); It's possible you're running into Issue #692, but I don't think that was rejecting (just never resolving). For a working (when Issue #692 is fixed) example, see my I'll be pushing these changes to |
As an aside, I also ran into the issue of only one platform being supported. I suggest opening a separate issue to track that request, if it's important. As you can see in the |
hi, |
Ya, the error only being "1" makes sense (but should also be fixed):
@tharatau, you should probably be calling |
maybe to add... if the cache is cleared, the above script downloads manifest.json and nw.zip |
Your fix for this isn't how ESM/async works. Example: const { nwbuild } = require('nw-builder');
console.log('nwbuild', nwbuild); You will see There are ways to support both CJS and ESM, but this isn't right. I believe you need to use a bundler to have the scripts built as ESM/CJS, but I'm not sure. |
If you're using it via a shell command, maybe the [
Apologies for this, oversight on my part. Temporary workaround would be using
I'm working on documentation and adding a migration guide here but it far from complete.
I will try to reproduce on my end.
v4
Officially only x64 build is supported right now. More info on that here: nwjs/nw.js#7620 |
Yeah my bad I definitily I did this in haste without testing thoroughly. I'll look into the bundler solution. |
remark: |
hi,
i'm using nw-builder inside a macos node js shell command "nwbuild".
since 4.0.0 var NwBuilder = require('nw-builder'); is not supported anymore (Error ERR_REQUIRE_ESM)
but if i add type: "module" to the package.json and change to: import { nwbuild } from 'nw-builder';
i get Error ERR_UNKNOWN_FILE_EXTENSION because im running "nwbuild" without extension
is there a way around changing the commands name to nwbuild.js ?
if i do and replace:
by
i get this :
% nwbuild_test.js
[ INFO ] Manifest file already exists locally under _nwcache
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 100% | ETA: 0s | 22833/22833
Promise Rejected
a small porting guide from 3.x to 4.x would be nice
what is the problem with the code?
do the platforms need to be built separately now?
what about arm64 / universal on osx?
The text was updated successfully, but these errors were encountered: