Skip to content

Commit ea77841

Browse files
🔨 config(build): Use @babel/cli instead of microbundle.
Microbundle does not work well with the current exports structure.
1 parent 01b9e02 commit ea77841

File tree

2 files changed

+514
-1413
lines changed

2 files changed

+514
-1413
lines changed

package.json

+94-14
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,33 @@
2121
],
2222
"sideEffects": false,
2323
"source": "src/index.js",
24-
"main": "dist/index.js",
25-
"module": "dist/index.module.js",
26-
"esmodule": "dist/index.modern.js",
27-
"umd:main": "dist/index.umd.js",
28-
"unpkg": "dist/index.umd.js",
24+
"main": "dist/default/index.js",
25+
"module": "dist/module/index.js",
26+
"esmodule": "dist/module/index.js",
2927
"exports": {
3028
".": {
31-
"browser": "./dist/index.module.js",
32-
"umd": "./dist/index.umd.js",
33-
"require": "./dist/index.js",
34-
"default": "./dist/index.modern.js"
29+
"browser": "./dist/browser/index.js",
30+
"node": "./dist/node/index.js",
31+
"default": "./dist/default/index.js"
32+
},
33+
"./*": {
34+
"browser": "./dist/browser/*.js",
35+
"node": "./dist/node/*.js",
36+
"default": "./dist/default/*.js"
3537
}
3638
},
3739
"files": [
3840
"dist"
3941
],
4042
"scripts": {
41-
"build": "NODE_ENV=production microbundle",
43+
"build": "npm-run-all --parallel build:*",
44+
"build-cmd": "babel --delete-dir-on-start --source-maps --minified src",
4245
"build-docs": "esdoc",
4346
"build-gh-pages": "npm run build-docs",
47+
"build:browser": "npm run build-cmd -- --env-name browser --out-dir dist/browser",
48+
"build:default": "npm run build-cmd -- --env-name production --out-dir dist/default",
49+
"build:module": "npm run build-cmd -- --env-name module --out-dir dist/module",
50+
"build:node": "npm run build-cmd -- --env-name node --out-dir dist/node",
4451
"ci:test": "npm run lint-config && npm run lint && npm run cover",
4552
"commit-msg": "commitlint --edit",
4653
"cover": "NODE_ENV=cover c8 --all --src src --reporter lcov --reporter text-summary --reporter text npm test",
@@ -62,6 +69,7 @@
6269
"dependencies": {},
6370
"devDependencies": {
6471
"@aureooms/js-itertools": "5.1.0",
72+
"@babel/cli": "^7.13.14",
6573
"@babel/core": "7.13.15",
6674
"@babel/preset-env": "7.13.15",
6775
"@babel/register": "7.13.14",
@@ -70,6 +78,7 @@
7078
"ava": "3.15.0",
7179
"babel-plugin-transform-remove-console": "6.9.4",
7280
"babel-plugin-unassert": "3.0.1",
81+
"babel-preset-minify": "^0.5.1",
7382
"babel-preset-power-assert": "3.0.0",
7483
"c8": "7.7.1",
7584
"coveralls": "3.1.0",
@@ -80,8 +89,8 @@
8089
"fixpack": "4.0.0",
8190
"husky": "6.0.0",
8291
"lint-staged": "10.5.4",
83-
"microbundle": "0.13.0",
8492
"np": "7.4.0",
93+
"npm-run-all": "^4.1.5",
8594
"pinst": "2.1.6",
8695
"power-assert": "1.6.1",
8796
"regenerator-runtime": "0.13.7",
@@ -143,6 +152,12 @@
143152
"babel-preset-power-assert"
144153
]
145154
},
155+
"cover": {
156+
"sourceMaps": "both",
157+
"presets": [
158+
"babel-preset-power-assert"
159+
]
160+
},
146161
"development": {
147162
"presets": [
148163
[
@@ -167,16 +182,81 @@
167182
"maintained node versions"
168183
]
169184
}
185+
],
186+
[
187+
"minify",
188+
{
189+
"builtIns": false
190+
}
170191
]
171192
],
172193
"plugins": [
173194
"babel-plugin-unassert"
174195
]
175196
},
176-
"cover": {
177-
"sourceMaps": "both",
197+
"browser": {
178198
"presets": [
179-
"babel-preset-power-assert"
199+
[
200+
"@babel/preset-env",
201+
{
202+
"targets": [
203+
"defaults"
204+
]
205+
}
206+
],
207+
[
208+
"minify",
209+
{
210+
"builtIns": false
211+
}
212+
]
213+
],
214+
"plugins": [
215+
"babel-plugin-unassert"
216+
]
217+
},
218+
"node": {
219+
"presets": [
220+
[
221+
"@babel/preset-env",
222+
{
223+
"targets": [
224+
"maintained node versions"
225+
]
226+
}
227+
],
228+
[
229+
"minify",
230+
{
231+
"builtIns": false
232+
}
233+
]
234+
],
235+
"plugins": [
236+
"babel-plugin-unassert"
237+
]
238+
},
239+
"module": {
240+
"presets": [
241+
[
242+
"@babel/preset-env",
243+
{
244+
"bugfixes": true,
245+
"modules": false,
246+
"targets": {
247+
"esmodules": true
248+
}
249+
}
250+
],
251+
[
252+
"minify",
253+
{
254+
"builtIns": false
255+
}
256+
]
257+
],
258+
"plugins": [
259+
"babel-plugin-unassert"
180260
]
181261
}
182262
}

0 commit comments

Comments
 (0)