Skip to content

Commit

Permalink
Update task_all.ts to support treeshaking with esm.
Browse files Browse the repository at this point in the history
When someone imports files from this library by using import statement, it will automatically use `index.esm.js` file without specifying `type: module` in index.js.

Currently typescript complains about the type If you directly import esm files which can be solved by specifying types.

should also resolve issue react-icons#154 without using all-files
  • Loading branch information
oztek22 committed May 4, 2023
1 parent fcc5b20 commit 636bc3f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/react-icons/scripts/task_all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,16 @@ export async function dirInit({ DIST, LIB, rootDir }) {
JSON.stringify(
{
sideEffects: false,
module: "./index.esm.js",
module: "./index.esm.js",,
"types": "./index.d.ts",
"exports": {
".": {
"types": "./index.d.ts",
"import": "./index.esm.js",
"require": "./lib/index.js"
},
"./package.json": "./package.json"
},
},
null,
2
Expand Down

0 comments on commit 636bc3f

Please sign in to comment.