Skip to content

Commit 7cfc48e

Browse files
committed
feat: add full ESM support
1 parent ce239af commit 7cfc48e

File tree

3 files changed

+2528
-3737
lines changed

3 files changed

+2528
-3737
lines changed

.babelrc.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,8 @@ module.exports = (api) => ({
44
['@babel/react', { runtime: 'automatic' }],
55
'@babel/preset-typescript',
66
],
7-
plugins: [api.env() === 'test' && 'istanbul'].filter(Boolean),
7+
plugins: [
8+
'babel-plugin-add-import-extension',
9+
api.env() === 'test' && 'istanbul',
10+
].filter(Boolean),
811
});

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"scripts": {
6868
"bootstrap": "yarn --network-timeout 100000 && yarn --cwd www --network-timeout 100000",
6969
"build": "rimraf lib && yarn build:esm && yarn build:cjs && yarn build:popper",
70-
"build:esm": "babel src --out-dir lib --delete-dir-on-start --extensions .ts,.tsx --ignore '**/*.d.ts' && yarn build:esm:types",
70+
"build:esm": "babel src --out-dir lib --delete-dir-on-start --extensions .ts,.tsx --ignore '**/*.d.ts' && yarn build:esm:types && echo '{\"type\": \"module\"}' > lib/package.json",
7171
"build:cjs": "babel src --out-dir cjs --env-name cjs --delete-dir-on-start --extensions .ts,.tsx --ignore '**/*.d.ts' && yarn build:cjs:types && echo '{\"type\": \"commonjs\"}' > cjs/package.json",
7272
"build:esm:types": "tsc -p . --emitDeclarationOnly --declaration --outDir lib",
7373
"build:cjs:types": "tsc -p . --emitDeclarationOnly --declaration --outDir cjs",
@@ -100,7 +100,7 @@
100100
"@restart/hooks": "^0.6.2",
101101
"@types/warning": "^3.0.3",
102102
"dequal": "^2.0.3",
103-
"dom-helpers": "^5.2.0",
103+
"dom-helpers": "^6.0.1",
104104
"uncontrollable": "^9.0.0",
105105
"warning": "^4.0.3"
106106
},
@@ -131,6 +131,7 @@
131131
"@vitest/browser": "^3.1.3",
132132
"@vitest/coverage-istanbul": "3.1.3",
133133
"babel-eslint": "^10.1.0",
134+
"babel-plugin-add-import-extension": "^1.6.0",
134135
"babel-preset-env-modules": "^1.0.1",
135136
"cross-env": "^7.0.3",
136137
"eslint": "^9.20.0",

0 commit comments

Comments
 (0)