0.0.7 • Published 8 months ago

@mayank1513/esbuild-plugin-ignoretests v0.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

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 @mayank1513/esbuild-plugin-ignoretests
# or
$ npm install @mayank1513/esbuild-plugin-ignoretests
# or
$ yarn add @mayank1513/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.