Skip to content

andreventuravale/esbuild-plugin-wildcard-imports

Repository files navigation

Coverage report


Limitations & Known issues

  • Only works with platform=node and bundle=true

  • The majority of the automated tests covers format=cjs

  • Dynamic imports with top-level await won't work with format=cjs

FAQ

  • Does it work with format=esm?

    • The esm output format was tested to the extent necessary to attain 100% code coverage; however, it was not thoroughly examined for all conceivable scenarios and opportunities.
  • Does format=cjs mean the plugin only works with a CommonJS codebase?

    • Not at all, you can use the plugin with your ES codebase. The format=cjs is about the esbuild output format. The library has been tested and works with ES modules.
  • Does it work with non-Node.js platforms?

    • I haven't had the time to write tests to cover non-Node.js platforms, so I intentionally limited the usage to on the Node.js for now.
  • Are there any plans to migrate it to Go?

    • Yes but I need to learn Go first.

Behaviors


Instalation

pnpm add esbuild-plugin-wildcard-imports --save-dev
yarn add esbuild-plugin-wildcard-imports --dev
npm install esbuild-plugin-wildcard-imports --save-dev

Usage examples

Basic use

import * as esbuild from 'esbuild'
import wildcardImports from 'esbuild-plugin-wildcard-imports'

await esbuild.build({
  plugins: [wildcardImports()]
})

With custom ignore patterns

import * as esbuild from 'esbuild'
import wildcardImports from 'esbuild-plugin-wildcard-imports'

await esbuild.build({
  plugins: [
    wildcardImports({
      ignore: ['**/{build,dist}', '**/foo', '**/bar']
    })
  ]
})

Options

name type optional notes
ignore string[] yes same semantics of fast-glob

Some examples where the plugin applies

About

Wildcard imports for esbuild.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published