esbuild-plugin-ignoretests
TypeScript icon, indicating that this package has built-in type declarations

0.0.7 • Public • Published

Turborepo template codecov Version Downloads Unit Tests npm bundle size

ESBuild plugin to ignore/exclude test files from build.

While building large libraries, we follow convention similar to chakraui -> component and corresponding tests for the component live in the same dedicated folder. In this scenario, tsup will build and include test file as well in the final build output. This is not desirable. This plugin will easily ignore test files from build process. You can also pass in custom regexp to ignore other files based on path.

Compatibility

  • JavaScript/TypeScript React libraries using tsup or other builders based on esbuild

This plugin seamlessly integrates with tsup and any other builders based on esbuild.

Install

$ pnpm add esbuild-plugin-ignoretests
# or
$ npm install esbuild-plugin-ignoretests
# or
$ yarn add esbuild-plugin-ignoretests

Usage

// tsup.config.ts or tsup.config.js
import { defineConfig } from "tsup";
import ignoretestsPlugin from "esbuild-plugin-ignoretests";

export default defineConfig(options => ({
    ...
    esbuildPlugins:[ignoretestsPlugin()]
}));

optionally you can also pass custom regular expression.

export default defineConfig(options => ({
    ...
    esbuildPlugins:[ignoretestsPlugin({ customRegExp: /my-reg-exp/ })]
}));

🤩 Don't forger to start this repo!

Want handson course for getting started with Turborepo? Check out React and Next.js with TypeScript

License

Licensed as MIT open source.


with 💖 by Mayank Kumar Chaudhari

Package Sidebar

Install

npm i esbuild-plugin-ignoretests

Weekly Downloads

72

Version

0.0.7

License

MIT

Unpacked Size

4.99 kB

Total Files

4

Last publish

Collaborators

  • mayank1513