-
Notifications
You must be signed in to change notification settings - Fork 252
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: export types and commonjs bundle (#821)
- Loading branch information
1 parent
1a5e2a7
commit 4f56856
Showing
3 changed files
with
20 additions
and
13 deletions.
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 |
---|---|---|
@@ -1,23 +1,24 @@ | ||
;(async () => { | ||
const child = require('child_process') | ||
const fs = require('fs') | ||
const {build} = require('esbuild') | ||
|
||
await build({ | ||
outdir: 'dist', | ||
outfile: 'dist/index.mjs', | ||
format: 'esm', | ||
target: 'es6', | ||
bundle: true, | ||
external: ['@testing-library/dom'], | ||
entryPoints: ['src/index.ts'], | ||
}) | ||
|
||
fs.writeFileSync( | ||
'dist/package.json', | ||
JSON.stringify({ | ||
type: 'module', | ||
}), | ||
) | ||
await build({ | ||
outfile: 'dist/index.cjs', | ||
format: 'cjs', | ||
target: 'node12', | ||
bundle: true, | ||
external: ['@testing-library/dom'], | ||
entryPoints: ['src/index.ts'], | ||
}) | ||
|
||
child.execSync('yarn tsc -p tsconfig.build.json') | ||
})() |
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
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