-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: full CJS/ESM hybrid support with tsup (#303)
* fix: full CJS/ESM hybrid support with tsup * chore: update lock file
- Loading branch information
1 parent
ab0fda2
commit 002e090
Showing
4 changed files
with
905 additions
and
48 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { defineConfig } from 'tsup'; | ||
|
||
export default defineConfig(options => [ | ||
// for bundlers like vite, rollup, esbuild, webpack etc | ||
{ | ||
entry: ['src/**.ts'], | ||
format: ['esm'], | ||
splitting: false, | ||
sourcemap: true, | ||
// clean: true, | ||
dts: !options.watch, | ||
outExtension: ({ format }) => ({ js: format === 'cjs' ? '.cjs' : '.mjs' }), | ||
}, | ||
// common js for node and other backend runtimes | ||
{ | ||
entry: ['src/index.ts'], | ||
format: ['cjs'], | ||
splitting: false, | ||
sourcemap: true, | ||
// clean: true, | ||
dts: !options.watch, | ||
outExtension: ({ format }) => ({ | ||
js: format === 'cjs' ? '.cjs' : '.mjs', | ||
}), | ||
}, | ||
|
||
// IIFE bundle js for cdn (window object for legacy <script>) | ||
// { | ||
// entry: { | ||
// 'multiple-select': 'src/index.ts', | ||
// }, | ||
// format: ['iife'], | ||
// globalName: 'MultipleSelect', | ||
// splitting: false, | ||
// sourcemap: true, | ||
// clean: true, | ||
// outExtension: ({ format }) => ({ | ||
// js: '.iife.js', | ||
// }), | ||
// }, | ||
]); |
Oops, something went wrong.