generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bundle ed25519-keygen for cjs (#470)
- Loading branch information
1 parent
c11b5ff
commit 4417c0c
Showing
2 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import esbuild from 'esbuild'; | ||
import packageJson from '../package.json' assert { type: 'json' }; | ||
|
||
// list of dependencies that _dont_ ship cjs | ||
const includeList = new Set(['ed25519-keygen']); | ||
|
||
// create list of dependencies that we _do not_ want to include in our bundle | ||
const excludeList = []; | ||
for (const dependency in packageJson.dependencies) { | ||
if (includeList.has(dependency)) { | ||
continue; | ||
} else { | ||
excludeList.push(dependency); | ||
} | ||
} | ||
|
||
esbuild.build({ | ||
entryPoints : [ './src/index.ts' ], | ||
bundle : true, | ||
external : excludeList, | ||
format : 'cjs', | ||
sourcemap : true, | ||
platform : 'node', | ||
outfile : 'dist/cjs/index.js', | ||
allowOverwrite : true | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters