esbuild-shim-plugin
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

esbuild-shim-plugin

esbuild-shim-plugin is an esbuild plugin that polyfills support for the import.meta.url property for ESM modules and the require, __filename, and __dirname properties for CommonJS modules.

📦 Installation

pnpm i -D esbuild-shim-plugin

📖 Usage

import { build } from 'esbuild';
import { shimPlugin } from 'esbuild-shim-plugin';

await build({
  format: 'esm',
  plugins: [shimPlugin()],
  // ... rest of the configuration
});
With tsup configuration
import { shimPlugin } from 'esbuild-shim-plugin';
import { defineConfig } from 'tsup';

export default defineConfig([
  {
    format: ['cjs', 'esm'],
    esbuildPlugins: [shimPlugin()],
    // ... rest of the configuration
  },
]);

🤝 Contributing

Want to contribute? Awesome! To show your support is to star the project, or to raise issues on GitHub.

Thanks again for your support, it is much appreciated! 🙏

Relevant

License

MIT © Shahrad Elahi

Package Sidebar

Install

npm i esbuild-shim-plugin

Weekly Downloads

101

Version

1.0.2

License

MIT

Unpacked Size

8.15 kB

Total Files

6

Last publish

Collaborators

  • shahradelahi