Skip to content

Commit 34ab21d

Browse files
committed
modern preset config; reduces payload dramatically
after investigating if builds could be smaller, basic syntax support for outdated browser tech w defaults is causing a lot of module bloat. Poly-fill transforms explicitly need to be excluded for base features
1 parent f2411ad commit 34ab21d

File tree

3 files changed

+33
-3
lines changed

3 files changed

+33
-3
lines changed

.babelrc

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,34 @@
11
{
22
"presets": [
3-
"@babel/preset-env"
3+
[
4+
"@babel/preset-env",
5+
{
6+
"targets": {
7+
"browsers": "last 2 versions, not ie 11",
8+
"node": "20"
9+
},
10+
"exclude": [
11+
"@babel/plugin-proposal-optional-chaining",
12+
"transform-destructuring",
13+
"transform-typeof-symbol",
14+
"transform-parameters",
15+
"transform-for-of",
16+
"transform-regenerator",
17+
"transform-object-rest-spread"
18+
]
19+
}
20+
]
21+
],
22+
"plugins": [
23+
[
24+
"@babel/plugin-transform-runtime",
25+
{
26+
"helpers": true,
27+
"regenerator": false
28+
}
29+
]
30+
],
31+
"ignore": [
32+
"**/*.test.js"
433
]
534
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{
22
"name": "use-viewport-sizes",
3-
"version": "0.7.3",
3+
"version": "0.8.0",
44
"description": "a tiny TS-compatible React hook which allows you to track visible window viewport size in your components w/ an optional debounce, throttle or custom memo function for updates for optimal rendering.",
55
"main": "./build/index.js",
66
"types": "./build/index.d.ts",
77
"scripts": {
88
"start": "webpack --watch --mode development",
99
"build": "webpack --mode production",
10+
"build:babel": "babel src --out-dir build --extensions \".js\"",
1011
"dev": "webpack-dev-server --env testServer --mode development --open",
1112
"prepublishOnly": "npm run build",
1213
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage"

webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module.exports = {
1515
include: path.resolve(__dirname, 'src'),
1616
exclude: /(node_modules|bower_components|build)/,
1717
use: {
18-
loader: 'babel-loader'
18+
loader: 'babel-loader',
1919
}
2020
}
2121
]

0 commit comments

Comments
 (0)