-
@esbuild-plugins/node-resolve
-
@esbuild-plugins/esm-externals
-
@esbuild-plugins/node-modules-polyfill
-
@esbuild-plugins/node-globals-polyfill
-
@esbuild-plugins/tsconfig-paths
-
@esbuild-plugins/webpack-loader-adapter
-
@esbuild-plugins/html
Resolve files with the resolve package and adds support for Yarn berry PnP.
import NodeResolve from '@esbuild-plugins/node-resolve'
import { build } from 'esbuild'
build({
plugins: [
NodeResolve({
extensions: ['.ts', '.js'],
onResolved: (resolved) => {
if (resolved.includes('node_modules')) {
return {
external: true,
}
}
return resolved
},
}),
],
})
Makes some packages externals and forces the output to be valid ESM
import EsmExternals from '@esbuild-plugins/esm-externals'
import { build } from 'esbuild'
build({
plugins: [EsmExternals({ externals: ['react', 'react-dom'] })],
})
Polyfills nodejs builtin modules for the browser
import NodeModulesPolyfills from '@esbuild-plugins/node-modules-polyfill'
import { build } from 'esbuild'
build({
plugins: [NodeModulesPolyfills()],
})
Polyfills nodejs globals like process
import EsmExternals from '@esbuild-plugins/node-globals-polyfill'
import { build } from 'esbuild'
build({
inject: [require.resolve('@esbuild-plugins/node-globals-polyfill/process')],
})