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
1
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 - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

0

dist/src/esbuildIgnoreWithCommentsPlugin.d.ts

@@ -0,0 +0,0 @@ import { Plugin } from 'esbuild';

@@ -0,0 +0,0 @@ "use strict";

6

package.json
{
"name": "esbuild-ignore-with-comments-plugin",
"version": "0.3.0",
"version": "0.3.1",
"description": "esbuild Plugin for ignoring files with specific comments in them",

@@ -10,3 +10,3 @@ "keywords": [

],
"homepage": "",
"homepage": "https://github.com/goldstack/goldstack/tree/master/workspaces/utils/packages/esbuild-ignore-with-comments-plugin",
"bugs": {

@@ -37,3 +37,3 @@ "url": "https://github.com/goldstack/goldstack/issues"

"devDependencies": {
"@goldstack/utils-git": "0.2.0",
"@goldstack/utils-git": "0.2.1",
"@types/jest": "^28.1.8",

@@ -40,0 +40,0 @@ "@types/node": "^18.7.13",

@@ -0,3 +1,63 @@

[![npm version](https://badge.fury.io/js/esbuild-ignore-with-comments-plugin.svg)](https://badge.fury.io/js/esbuild-ignore-with-comments-plugin)
# ESBuild Ignore with Comments Plugin
Allows inserting comments into TypeScript source files. ESBuild will ignore these files during build.
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:
```typescript
/* 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:
```typescript
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`
```typescript
/* esbuild-ignore ui */
// some server only stuff
```
`ui.ts`
```typescript
/* esbuild-ignore server */
// some ui only stuff
```
Then running the following will ignore `server.ts` during the build:
```typescript
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:
```typescript
/* esbuild-ignore server */
/* esbuild-ignore ui */
```
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