-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
maint/build ~ add
rollup
for ESM generation
- TypeScript fails to correctly generate an ESM module with correct line endings - ref: <microsoft/TypeScript#18442 (comment)> - ref: <microsoft/TypeScript#18442> - ref: <microsoft/TypeScript#37582> - ref: <microsoft/TypeScript#35148>
- Loading branch information
Showing
2 changed files
with
22 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// ref: <https://devhints.io/rollup> | ||
// setup: `npm i rollup @rollup/plugin-typescript` or `npm i rollup rollup-plugin-typescript2` (for visible TS error output) | ||
|
||
// import typescript from '@rollup/plugin-typescript'; | ||
import typescript from 'rollup-plugin-typescript2'; | ||
|
||
export default [ | ||
// ES module build (replaces broken basic TypeScript compilation) | ||
// * ref: <https://github.com/microsoft/TypeScript/issues/18442> , <https://github.com/alshdavid/rxjs/blob/main/rollup.config.js#L10> | ||
// * ref: <https://github.com/microsoft/TypeScript/pull/35148> | ||
// * ref: <https://github.com/microsoft/TypeScript/issues/37582> | ||
{ | ||
preserveModules: true, | ||
input: ['src/index.ts'], | ||
external: ['path', 'os'], | ||
output: [{ exports: 'auto', dir: 'build/esm', format: 'esm', entryFileNames: '[name].mjs' }], | ||
plugins: [typescript({ tsconfig: './tsconfig/tsconfig.esm.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