Registry / testing / esbuild-scalajs

esbuild-scalajs

JSON →
library0.0.5jsnpmunverified

An esbuild plugin for Scala.js that integrates the Scala.js build output (JavaScript files) into esbuild bundling. This plugin allows using esbuild to bundle Scala.js projects, replacing or supplementing the default Scala.js linker. Version 0.0.5 is experimental and pre-1.0; releases are sparse. It currently requires an existing Scala.js build (sbt fastOptJS/fullOptJS) and only bundles the resulting JavaScript. Unlike full build tools, it does not compile Scala code directly. The plugin is designed for developers already using Scala.js who want to leverage esbuild's fast bundling, code splitting, and plugin ecosystem. It is not actively maintained.

npm install esbuild-scalajs
INSTALL
IMPORT
SIG · ESBUILD-SCALAJS
E
esbuild-scalajs
testingjavascriptv0.0.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
✓ import scalaJsPlugin from 'esbuild-scalajs'
✗ const scalaJsPlugin = require('esbuild-scalajs')
The package exports a default function; using require may work but is not the intended ESM usage.
scalaJsPlugin
✓ import { scalaJsPlugin } from 'esbuild-scalajs'
✗ import scalaJsPlugin from 'esbuild-scalajs'
The package also exports a named export 'scalaJsPlugin' which is the same as default. Default import is preferred.
ScalaJsPluginOptions
✓ import type { ScalaJsPluginOptions } from 'esbuild-scalajs'
TypeScript users can import the options type for configuration. No CommonJS equivalent for types.

Basic usage: bundling a Scala.js output file with esbuild using the plugin. Assumes Scala.js has already been compiled.

import scalaJsPlugin from 'esbuild-scalajs'; import * as esbuild from 'esbuild'; await esbuild.build({ entryPoints: ['target/scala-2.13/example-fastopt/main.js'], bundle: true, outdir: 'dist', plugins: [scalaJsPlugin()], });
Debug
Known issues
breakingPlugin may not handle multiple entry points correctly; only single entry point tested.
fix
Use a single entry point or manually concatenate multiple Scala.js outputs before bundling.
affects: =0.0.5
gotchaRequires Scala.js to be compiled separately (sbt fastOptJS/fullOptJS) before running esbuild. Not a drop-in replacement for the Scala.js linker.
fix
Ensure Scala.js artifacts exist before running esbuild. Use sbt to compile first.
affects: >=0.0.0
deprecatedVersion 0.0.5 is pre-1.0; API may change in future releases.
fix
Pin to exact version and monitor repository for updates.
affects: <1.0.0
Errors
Common errors & fixes
Error: The plugin "scalaJsPlugin" returned a function (expected a plugin object) when called without options
Calling the default export without parentheses returns the function itself, not the plugin object.
fix
Use scalaJsPlugin() with empty parentheses to invoke and return the plugin object.
Error: [plugin: scalaJsPlugin] No such file or directory: 'target/scala-2.13/example-fastopt/main.js'
Scala.js has not been compiled yet, so the entry point file does not exist.
fix
Run sbt fastOptJS or fullOptJS before esbuild to generate the Scala.js output.
Upgrade
Version history
0.0.5latest on npm
Audit
Dependencies
esbuildrequiredThis is an esbuild plugin that hooks into esbuild's build process.
Agent activity
7 hits · last 30 days
node
6
Resources
esbuild-scalajs — npm install esbuild-scalajs · libregistry