Skip to content

Commit

Permalink
Use .mjs extension for ESM module
Browse files Browse the repository at this point in the history
* Update package.json according to #204
  • Loading branch information
timolins committed Jul 9, 2022
1 parent 3b9ef79 commit ae4a1eb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
23 changes: 11 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@
"toast",
"snackbar"
],
"main": "dist/index.esm.js",
"typings": "dist/index.d.ts",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"import": "./dist/index.esm.js",
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.js"
},
"./headless": {
"import": "./headless/index.esm.js",
"require": "./headless/index.js",
"types": "./headless/index.d.ts"
"types": "./headless/index.d.ts",
"import": "./headless/index.mjs",
"require": "./headless/index.js"
}
},
"files": [
Expand All @@ -41,8 +41,7 @@
"test": "echo \"No test specified\"",
"setup": "pnpm i && cd site && pnpm i && cd .. && pnpm run link",
"link": "pnpm link ./site/node_modules/react && pnpm link ./site/node_modules/react-dom",
"size": "size-limit",
"analyze": "size-limit --why"
"size": "size-limit"
},
"husky": {
"hooks": {
Expand All @@ -62,15 +61,15 @@
"limit": "5 KB"
},
{
"path": "dist/index.esm.js",
"path": "dist/index.mjs",
"limit": "5 KB"
},
{
"path": "headless/index.js",
"limit": "2 KB"
},
{
"path": "headless/index.esm.js",
"path": "headless/index.mjs",
"limit": "2 KB"
}
],
Expand Down
5 changes: 0 additions & 5 deletions tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ const commonConfig: Options = {
format: ['esm', 'cjs'],
sourcemap: true,
clean: true,
outExtension({ format }) {
return {
js: format === 'cjs' ? '.js' : `.${format}.js`,
};
},
};
export default defineConfig([
{
Expand Down

0 comments on commit ae4a1eb

Please sign in to comment.