Skip to content

Commit bddc939

Browse files
committed
Adds build-web script for transpiling an ES5 distribution
1 parent 796fa90 commit bddc939

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

babel.config.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module.exports = {
2+
env: {
3+
web: {
4+
presets: [
5+
[
6+
'@babel/preset-env',
7+
{
8+
useBuiltIns: 'entry',
9+
modules: false,
10+
corejs: 3,
11+
},
12+
],
13+
]
14+
},
15+
},
16+
};

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@
44
"description": "Build an element once, move it anywhere",
55
"main": "dist/cjs/index.js",
66
"module": "dist/esm/index.js",
7+
"browser": "dist/web/index.js",
78
"types": "dist/index.d.ts",
89
"files": [
910
"dist/**/*.{js,ts,map}",
1011
"src/**/*",
1112
"README.md"
1213
],
1314
"scripts": {
14-
"build": "rimraf dist/ && tsc -p tsconfig.cjs.json && tsc -p tsconfig.esm.json",
15+
"build": "rimraf dist/ && tsc -p tsconfig.cjs.json && tsc -p tsconfig.esm.json && npm run build-web",
16+
"build-web": "BABEL_ENV=web babel dist/esm --config-file=./babel.config.js --out-dir=dist/web",
1517
"pretest": "npm run build",
1618
"test": "echo \"It built ok, that'll do for now\"",
1719
"prepack": "npm run build",
@@ -38,6 +40,7 @@
3840
},
3941
"homepage": "https://github.com/httptoolkit/react-reverse-portal#readme",
4042
"devDependencies": {
43+
"@babel/cli": "^7.6.4",
4144
"@babel/core": "^7.5.5",
4245
"@storybook/addon-storysource": "^5.1.11",
4346
"@storybook/addons": "^5.1.11",

0 commit comments

Comments
 (0)