A utility to load and resolve JavaScript/TypeScript configuration files using esbuild. It reads configuration from .js, .ts, .mjs, or .cjs files, compiles them on-the-fly with esbuild, and returns the exported config object. Useful for tools that need to consume user config files (e.g., bundler plugins, CLI tools). Version 1.0.9 ships TypeScript type definitions and has no external dependencies beyond esbuild. Released under MIT license. Different from other config resolvers (like cosmiconfig) by leveraging esbuild for fast and correct TypeScript/ESM compilation.
npm install esbuild-resolve-configNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates how to import and call resolveConfig with a TypeScript config file, handling errors.
Ensure the config file does not rely on Node.js globals (e.g., process, require) unless they are provided by esbuild's define or inject features.
Ensure esbuild versions are compatible; consider using a single version via dependency resolution (e.g., npm dedupe or yarn resolutions).
Use default import: import resolveConfig from 'esbuild-resolve-config' instead of import { resolveConfig }.Change import to: import resolveConfig from 'esbuild-resolve-config'
Install esbuild: npm install esbuild --save-dev
Ensure the config file uses module.exports or default export; check esbuild loader settings if custom.
Verify that esbuild is properly installed and that the file path is correct. Use an absolute path if necessary.