Registry / devops / esbuild-plugin-toml

esbuild-plugin-toml

JSON →
library0.0.1jsnpmunverified

An esbuild plugin to load TOML files during bundling. Version 0.0.1 is the initial and only release, with no updates since 2021. The package is lightweight and depends on esbuild's plugin API, providing a simple setup. Compared to alternatives like @toml-tools/loader, it is minimal but lacks customization options (e.g., no support for custom parsing or multiple file patterns). It is designed for basic TOML loading use cases.

npm install esbuild-plugin-toml
INSTALL
IMPORT
SIG · ESBUILD-PLUGIN-TOM
E
esbuild-plugin-toml
devopsjavascriptv0.0.1
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.

toml
✓ import toml from 'esbuild-plugin-toml'
✗ const toml = require('esbuild-plugin-toml')
Package does not export a named function; default import is correct in ESM.
default
✓ const toml = require('esbuild-plugin-toml')
✗ const { toml } = require('esbuild-plugin-toml')
CommonJS require returns the plugin function directly, not as named export.
toml
✓ import toml from 'esbuild-plugin-toml'
Default import is the plugin function; no named exports.

Shows how to set up esbuild with the TOML plugin and import a TOML file in JavaScript.

// esbuild.config.js const esbuild = require('esbuild'); const tomlPlugin = require('esbuild-plugin-toml'); esbuild.build({ bundle: true, entryPoints: ['main.js'], outfile: 'out.js', plugins: [tomlPlugin()], }).catch(() => process.exit(1)); // main.js const config = require('./config.toml'); console.log(config);
Debug
Known issues
gotchaThe plugin only handles .toml files; other extensions are ignored.
fix
Ensure your TOML files have the .toml extension, or consider using a different plugin if custom extensions are needed.
affects: 0.0.1
deprecatedPackage has not been updated since 2021; may not support newer esbuild versions.
fix
Check compatibility with your esbuild version. If using esbuild >0.14, consider testing or using an alternative plugin.
affects: 0.0.1
Errors
Common errors & fixes
Error: No loader is configured for ".toml" files
Missing esbuild plugin configuration or plugin not registered.
fix
Ensure tomlPlugin() is added to the plugins array in esbuild.build options.
TypeError: toml is not a function
Incorrect import style; toml is the default export (a function) but was used as an object.
fix
Use `const tomlPlugin = require('esbuild-plugin-toml')` then call `tomlPlugin()`.
Upgrade
Version history
0.0.1latest on npm
Audit
Dependencies
esbuildrequiredPeer dependency required for plugin API
Agent activity
4 hits · last 30 days
node
4
Resources
esbuild-plugin-toml — npm install esbuild-plugin-toml · libregistry