NW.js SDK vs Normal Builds: Production Distribution Guide
NW.js provides SDK and normal build flavors. Ship normal to end users, use SDK for development, and automate both in CI with separate autoupdater channels.
15 Aug 2026, 05:38 UTC

The Decision You Face
Every NW.js project must choose a build flavor before shipping: SDK includes Chrome DevTools, normal strips DevTools. The choice affects bundle size, security posture, app-store compliance, and update mechanics. Ship the wrong flavor and you will fail store review, expose an attack surface, or break your autoupdater.
Takeaway: Use SDK builds only on developer machines and staging environments. Ship normal builds to end users. Automate both in CI so the distinction never becomes a manual decision.
Flavor Comparison at a Glance
| Attribute | SDK Build | Normal Build |
|---|---|---|
| Package name (npm) | nwjs-sdk | nw |
| Compressed size overhead | +40 to 60 MB | Baseline |
| Built-in DevTools UI | Present | Absent, win.showDevTools throws TypeError |
| V8 inspector protocol | Enabled | Enabled, attach external inspector via --remote-debugging-port |
| App-store eligibility | Rejected, macOS App Store and Microsoft Store | Accepted |
| Autoupdater compatibility | Updates only to SDK releases | Updates only to normal releases |
| Linux AppImage Flatpak | Fails sandbox checks on some distros | Supported |
Why the Split Exists
NW.js bundles Chromium and Node.js into a single runtime. The SDK flavor adds the full DevTools frontend and the V8 inspector protocol wiring that lets the frontend talk to the renderer. The normal flavor compiles the same Chromium and Node versions but omits devtools_frontend resources from nw.pak and disables the internal DevTools binding.
This is not a feature toggle. It is a compile-time decision. The two flavors have different nw.pak and icudtl.dat files, which means their code signatures differ. An app signed with the SDK runtime cannot verify an update packaged with the normal runtime, and vice versa.
Security and Compliance Constraints
Attack Surface
DevTools exposes a full JavaScript console with access to the renderer process. In a shipped app, any user who discovers the DevTools shortcut can execute arbitrary code in your app context, inspect network traffic, and manipulate the DOM. The normal build eliminates this vector entirely.
Store Policies
Apple App Store Review Guidelines and Microsoft Store Policy prohibit apps that include debugging or developer tools in the distributed binary. Submitting an SDK build guarantees rejection.
CI Pipeline: Build Both Flavors Automatically
The standard pattern is a dual-build pipeline. Below is a GitHub Actions workflow using @nwjs/builder. Adjust paths and signing identities for your project.
# .github/workflows/nwjs-build.yml
name: NW.js Dual Build
on:
push:
tags: ['v*']
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: macos-latest
flavor: sdk
artifact: MyApp-mac-sdk
- os: macos-latest
flavor: normal
artifact: MyApp-mac
- os: windows-latest
flavor: sdk
artifact: MyApp-win-sdk
- os: windows-latest
flavor: normal
artifact: MyApp-win
- os: ubuntu-latest
flavor: normal
artifact: MyApp-linux
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci
- name: Build NW.js app
uses: nwjs/builder@v1
with:
flavor: ${{ matrix.flavor }}
version: '0.86.0'
platforms: ${{ matrix.os == 'macos-latest' && 'mac' || matrix.os == 'windows-latest' && 'win' || 'linux' }}
arch: 'x64'
output: ${{ matrix.artifact }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: dist/${{ matrix.artifact }}/**
Where to run: GitHub Actions or any CI with macOS, Windows, and Linux runners. Permissions: repository write access for artifacts, macOS notarization requires Apple Developer Program membership, Windows signing requires a valid code-signing certificate stored as base64 in secrets. Placeholders: replace MyApp, version 0.86.0, signing identities, and secret names with your values. Expected check: each matrix job produces a signed package under dist/. Risk: mixing flavors in the same autoupdate channel breaks signature verification. Keep SDK and normal artifacts in separate release channels.
Version Pinning: Prevent Accidental Flavor Drift
NW.js releases track Chromium majors on roughly six to eight week cycles. A package.json dependency like "nw": "^0.86.0" pulls the latest patch but cannot distinguish SDK from normal. Always pin the exact flavored version.
{
"name": "my-app",
"version": "1.2.0",
"main": "index.html",
"scripts": {
"dev": "nw .",
"start": "nw ."
},
"devDependencies": {
"nwjs-sdk": "0.86.0-sdk"
},
"dependencies": {
"nw": "0.86.0"
}
}
Use nwjs-sdk only in devDependencies for local development. The production dependencies entry points to the normal flavor. Your CI workflow overrides both with explicit version and flavor inputs, so the lockfile is the source of truth for developers while CI is the source of truth for releases.
Validating the Flavor at Runtime
Add a small guard in your app entry point to confirm the running flavor matches expectations. This catches mispackaged builds before they reach users.
const fs = require('fs');
const path = require('path');
function detectFlavor() {
const pakPath = path.join(process.execPath, '..', 'nw.pak');
if (fs.existsSync(pakPath)) {
try {
const buf = fs.readFileSync(pakPath);
if (buf.includes('devtools_frontend')) return 'sdk';
return 'normal';
} catch { /* fall through */ }
}
return 'unknown';
}
const EXPECTED_FLAVOR = process.env.NW_EXPECTED_FLAVOR || 'normal';
const actual = detectFlavor();
if (actual !== EXPECTED_FLAVOR) {
const msg = 'Flavor mismatch: expected ' + EXPECTED_FLAVOR + ', running ' + actual;
console.error(msg);
process.exit(1);
}
Set NW_EXPECTED_FLAVOR=normal in production CI and NW_EXPECTED_FLAVOR=sdk in the SDK build step. The check runs at startup and exits with a clear message if the artifact does not match.
External Debugging Without Shipping DevTools
The normal build still speaks the V8 inspector protocol. To debug a staged normal build, launch it with a remote debugging port and attach Node inspector or Chrome DevTools from a separate browser window:
# On the test machine
/path/to/MyApp --remote-debugging-port=9229
# In Chrome, open chrome://inspect and click inspect under the NW.js target
This works because the V8 inspector backend is compiled into both flavors. Only the frontend UI is removed. No SDK runtime required.
Linux Distribution Caveats
The matrix above omits SDK for Linux. AppImage and Flatpak sandboxes, particularly those using seccomp filters, often reject the additional DevTools binaries in the SDK flavor, causing launch failures with obscure syscall errors. The normal flavor passes sandbox validation consistently. If you need a Linux SDK build for internal testing, distribute it as a plain tar.gz outside the sandboxed formats.
Autoupdater Channel Separation
If you use nwjs-autoupdater or a custom Sparkle integration, maintain two distinct update feeds:
- https://updates.example.com/app/sdk/latest.yml — serves SDK builds to developer machines
- https://updates.example.com/app/stable/latest.yml — serves normal builds to users
The updater compares the running binary flavor against the feed artifacts. A mismatch throws a verification error and aborts the update. Never mix flavors in a single feed.
Limitations and Verification Checklist
- No runtime switching: You cannot enable DevTools in a normal build via flags or config. The code paths are compiled out.
- Size measurement: Download both tar.gz files for the same version from https://nwjs.io/versions and compare extracted sizes. SDK will be 40 to 60 MB larger.
- User-agent check: Run nw --version on each flavor. Both report identical Chromium, Node, and V8 versions, but SDK includes nwjs-sdk in the user-agent string.
- DevTools call test: Launch a minimal app with win.showDevTools in the normal build. Expect a TypeError.
- Pak inspection: Run strings nw.pak | grep -i devtools on each flavor. Normal returns no matches.
Complete these checks once per NW.js version upgrade. Document the results in your release notes so future maintainers understand the flavor boundary.
Summary
SDK for developers, normal for users. Automate the split in CI, pin exact versions, separate update channels, and validate at startup. The 40 to 60 MB savings and store compliance are non-negotiable for production. The debugging workflow remains intact via --remote-debugging-port. Treat flavor as a build-time constant, not a runtime option.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.