Registry / devops / esbuild-gjs

esbuild-gjs

JSON →
library1.3.0jsnpmunverified

esbuild-gjs is an ESBuild plugin for building applications for Gjs (GNOME JavaScript runtime). It transpiles Gjs modules, handles GResource files, and supports both ESM and CJS output formats. Version 1.3.0 is current, with a monthly release cadence. Unlike generic bundlers, it integrates tightly with Gjs's module system and GLib/GTK APIs. Notable features: automatic GResource bundling, TypeScript support out of the box, and compatibility with ESBuild's plugin ecosystem. It requires esbuild ^0.28.0 as a peer dependency. The plugin is actively maintained and ships TypeScript type definitions.

npm install esbuild-gjs
INSTALL
IMPORT
SIG · ESBUILD-GJS
E
esbuild-gjs
devopsjavascriptv1.3.0
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.

gjsPlugin
import { gjsPlugin } from 'esbuild-gjs'
const gjsPlugin = require('esbuild-gjs')
ESM-only; require() will fail. Use ESM imports.
plugin (default)
import gjsPlugin from 'esbuild-gjs'
import { default as gjsPlugin } from 'esbuild-gjs'
Both named and default exports point to the same plugin function. Prefer named for clarity.
GResourcePlugin
import { GResourcePlugin } from 'esbuild-gjs'
import GResourcePlugin from 'esbuild-gjs'
Named export only; no default export for GResourcePlugin.

Builds a Gjs application with ESBuild using the esbuild-gjs plugin. Configures entry point, output, and Gjs-specific options.

import { gjsPlugin } from 'esbuild-gjs'; import { build } from 'esbuild'; await build({ entryPoints: ['src/main.ts'], bundle: true, outfile: 'dist/main.js', plugins: [gjsPlugin()], format: 'esm', target: 'gnome-42', platform: 'node', sourcemap: true, define: { 'process.env.NODE_ENV': JSON.stringify('production') } });
Debug
Known issues
breakingPlugin API changed: v1.0 dropped support for ESBuild v0.10-v0.27. Must now use ESBuild ^0.28.0.
fix
Upgrade ESBuild to ^0.28.0 or later.
affects: >=1.0.0
gotchaThe plugin may fail silently if GResource files are missing or misconfigured. Always check generated output.
fix
Ensure all GResource XML files are in the correct paths and referenced properly.
affects: >=0.1.0
gotchaTypeScript users must set 'format' to 'esm' in ESBuild config; CommonJS output is not supported for Gjs modules.
fix
Use format: 'esm' and target: 'gnome-42' or later.
affects: >=1.0.0
deprecatedThe 'gResourcePlugin' alias (plural) is deprecated in favor of 'GResourcePlugin' (capital G).
fix
Use 'GResourcePlugin' instead.
affects: >=1.2.0
gotchaThe plugin does not support multiple entry points with different GResource sets; merge them manually.
fix
Bundle all GResource files into a single resource or use separate builds.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'esbuild-gjs'
Package not installed or wrong import method (CommonJS require).
fix
Run: npm install esbuild-gjs esbuild@^0.28.0. Ensure you are using ESM imports.
TypeError: gjsPlugin is not a function
Importing the default export incorrectly (e.g., using named import on default).
fix
Use: import { gjsPlugin } from 'esbuild-gjs'; or import gjsPlugin from 'esbuild-gjs';
Build failed: GResource not found: .../resource.gresource.xml
GResource file path is incorrect or missing.
fix
Verify that the path in gjsPlugin({ gresource: '...' }) exists and is correct.
Upgrade
Version history
1.3.0latest on npm
Audit
Dependencies
esbuildrequiredPeer dependency; the plugin extends ESBuild and is injected into its build pipeline.
Agent activity
2 hits · last 30 days
node
2
Resources
esbuild-gjs — npm install esbuild-gjs · libregistry