1.0.1 • Published 6 months ago
esbuild-shim-plugin v1.0.1
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! 🙏