Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

esbuild-ignore-with-comments-plugin

Package Overview
Dependencies
Maintainers
0
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esbuild-ignore-with-comments-plugin

esbuild Plugin for ignoring files with specific comments in them

  • 0.3.15
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

npm version

ESBuild Ignore with Comments Plugin

Allows inserting comments into TypeScript source files. ESBuild will ignore these files during build.

Usage

Add to any .ts or .tsx file the following comment:

/* esbuild-ignore */

This file will be replaced with a source file that has an empty object as a default export.

Configure the plugin for esbuild as follows:

import ignorePlugin from 'esbuild-ignore-with-comments-plugin';
import { build } from 'esbuild';

await build({
  plugins: [ignorePlugin()],
});

If you are bundling the same files multiple times (such as for server-side rendering) you can group files into sets and only ignore specific sets of files.

For instance, assume you have the following files:

server.ts

/* esbuild-ignore ui */

// some server only stuff

ui.ts

/* esbuild-ignore server */

// some ui only stuff

Then running the following will ignore server.ts during the build:

await build({
  plugins: [ignorePlugin(['ui'])],
});

Note that files that have the comment /* esbuild-ignore */ without specifying a group will always be ignored.

Also note that if you want to add a file to multiple groups, you need to include multiple esbuild-ignore comments, such as:

/* esbuild-ignore server */
/* esbuild-ignore ui */

Keywords

FAQs

Package last updated on 23 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc