A esbuild plugin to support path alias like resolve.alias
in webpack config.
npm install -D esbuild-plugin-path-alias
const esbuild = require('esbuild');
const aliasPlugin = require('esbuild-plugin-path-alias');
const path = require('path');
esbuild.build({
entryPoints: [path.resolve(__dirname, './app/app.jsx')],
bundle: true,
outdir: 'dist',
external: ['react'],
plugins: [
aliasPlugin({
// must be absolute path
'@': path.resolve(__dirname, './app/component')
})
],
logLevel: 'debug'
});
See test for details.