Skip to content

Commit

Permalink
docs: added esbuild.loader docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Flammae committed Sep 7, 2023
1 parent cb427d9 commit 4737f00
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,12 @@ export const unplugin = createUnplugin((options: UserOptions, meta) => {
console.log(meta.framework) // 'vite' | 'rollup' | 'webpack' | 'rspack' | 'esbuild'

return {
// common unplugin hooks
// Common unplugin hooks
name: 'unplugin-prefixed-name',
transformInclude(id) { /* ... */ },
transform(code) { /* ... */ },

// framework specific hooks
// Framework specific hooks
vite: {
// Vite plugin
configureServer(server) {
Expand All @@ -209,16 +209,21 @@ export const unplugin = createUnplugin((options: UserOptions, meta) => {
// Rollup plugin
},
webpack(compiler) {
// configure Webpack compiler
// Configure Webpack compiler
},
rspack(compiler) {
// configure Rspack compiler
// Configure Rspack compiler
},
esbuild: {
// change the filter of onResolve and onLoad
// Change the filter of onResolve and onLoad
// onResolveFilter?: RegExp,
// onLoadFilter?: RegExp,
// or you can completely replace the setup logic

// Tell esbuild how to interpret the contents. By default unplugin tries to guess the loader
// from file extension (eg: .js -> "js", .jsx -> 'jsx')
// loader?: (Loader | (code: string, id: string) => Loader)

// Or you can completely replace the setup logic
// setup?: EsbuildPlugin.setup,
},
}
Expand Down

0 comments on commit 4737f00

Please sign in to comment.