slice2js is the official Slice-to-JavaScript compiler from ZeroC, part of the Ice RPC framework. It compiles Slice IDL files into JavaScript proxy and skeleton code for building networked applications. The current stable version is 3.7.110 (Ice 3.7.x series). Release cadence follows Ice releases, approximately every 6-12 months. Key differentiator: it's the native compiler for Ice's JavaScript mapping, tightly coupled with the @zeroc/ice npm package. Alternatives like protobuf or Thrift require separate toolchains.
npm install slice2jsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates how to import slice2js, compile a Slice file, handle exit codes, and access the built-in Slice include path.
Upgrade to Node.js >=14 and adjust code for any API changes.
Remove '--ice' from args. The sliceDir property provides the path if needed.
Wrap compile in a promise or use child_process.execFile for simpler error handling.
Install both as dependencies: npm install slice2js --save-dev && npm install @zeroc/ice
Use absolute paths or set the 'cwd' option in the second argument to compile().
Run 'npm install slice2js --save-dev' in your project directory.
Use const slice2js = require('slice2js'); instead of import.Remove --ice from the arguments; Ice includes are added automatically.
Use an absolute path or set the cwd option: slice2js.compile(['Hello.ice'], { cwd: __dirname }).