Webpack loader for esbuild: Speed up your build ⚡️
ESBuildMinifyPlugin
was renamed to EsbuildPlugin
to indicate it can be used as a general interface to esbuild (not just a minifier, but transformer).
Import EsbuildPlugin
instead:- const { ESBuildMinifyPlugin } = require('esbuild-loader')
+ const { EsbuildPlugin } = require('esbuild-loader')
.js
, .jsx
, .ts
, .tsx
, .css
files, you no longer need to set the loader
option because esbuild-loader
can now detect how to handle them based on the extension. This also means you can consolidate esbuild-loader
rules for different file types into one, rather than hard-coding how to load each extension type. module: {
rules: [
{
test: /\.[tj]sx?$/,
loader: 'esbuild-loader',
options: {
target: 'es2015',
- loader: 'tsx',
},
},
],
},
👉 Note: For this to work, make sure to follow file extension conventions such as using
.jsx
/.tsx
for files that contain JSX.
You can now use the tsconfig
property to pass in a tsconfig file, and it will even resolve extends
tsconfig.json includes
/excludes
/files
are now respected so it will only apply the tsconfig.json
to matching files. However, TypeScript compilation will always work regardless of tsconfig.json
.
If Webpack's target is web
, EsbuildPlugin
will default to using format: iife
unless otherwise specified. This change was made to prevent window pollution.
Make sure your Node.js version is at least v16
sourcemap
option (#305) (53cbc73)ESBuildMinifyPlugin
to EsbuildPlugin
(#307) (b052cdd)tsconfig
option (#311) (92b49e9)format
to iife
(a9e8e7e)tsconfig.json
is now only applied to files it matches (via include
/exclude
/files
)iife
when Webpack's target is web
& esbuild's target is below esnext
ESBuildMinifyPlugin
renamed to EsbuildPlugin
; MinifyPluginOptions
renamed to EsbuildPluginOptions
sourcemap
option removed