esbuild-ignore-with-comments-plugin
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -0,0 +0,0 @@ import { Plugin } from 'esbuild'; |
@@ -0,0 +0,0 @@ "use strict"; |
{ | ||
"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 */ | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
8254
1
64