Skip to content

Commit

Permalink
fix(esm): added export mapping to package.json for proper cjs/esm ent…
Browse files Browse the repository at this point in the history
…rypoints
  • Loading branch information
favna committed May 6, 2024
1 parent d811c97 commit c7eb8bc
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion resources/build-npm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,20 @@ function buildPackage(outDir: string, isESMOnly: boolean): void {
packageJSON.version += '+esm';
} else {
delete packageJSON.type;
packageJSON.main = 'index';
packageJSON.main = 'index.js';
packageJSON.module = 'index.mjs';
packageJSON.types = 'index.d.ts';
packageJSON.exports = {
'.': {
'import': {
'types': './index.d.ts',
'default': './index.mjs'
},
'require': {
'types': './index.d.ts',
'default': './index.js'
}
}
emitTSFiles({ outDir, module: 'commonjs', extension: '.js' });
emitTSFiles({ outDir, module: 'es2020', extension: '.mjs' });
}
Expand Down

0 comments on commit c7eb8bc

Please sign in to comment.