1
0
Fork 0

Use preact instead of react, reducing bundle size for >100KB

Signed-off-by: Egor Savkin <es@m-labs.hk>
This commit is contained in:
Egor Savkin 2024-01-09 12:58:45 +08:00
parent fcf0f49816
commit 70b8dd1075
4 changed files with 20 additions and 2 deletions

11
package-lock.json generated
View File

@ -19,6 +19,7 @@
"bootstrap": "^5.3.0", "bootstrap": "^5.3.0",
"jquery": "^3.7.0", "jquery": "^3.7.0",
"json-logic-js": "^2.0.2", "json-logic-js": "^2.0.2",
"preact": "^10.19.3",
"prop-types": "^15.8.1", "prop-types": "^15.8.1",
"react": "^18.2.0", "react": "^18.2.0",
"react-bootstrap": "^2.9.1", "react-bootstrap": "^2.9.1",
@ -3992,6 +3993,16 @@
"url": "https://github.com/sponsors/sindresorhus" "url": "https://github.com/sponsors/sindresorhus"
} }
}, },
"node_modules/preact": {
"version": "10.19.3",
"resolved": "https://registry.npmjs.org/preact/-/preact-10.19.3.tgz",
"integrity": "sha512-nHHTeFVBTHRGxJXKkKu5hT8C/YWBkPso4/Gad6xuj5dbptt9iF9NZr9pHbPhBrnT2klheu7mHTxTZ/LjwJiEiQ==",
"dev": true,
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/preact"
}
},
"node_modules/prop-types": { "node_modules/prop-types": {
"version": "15.8.1", "version": "15.8.1",
"resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz",

View File

@ -32,7 +32,8 @@
"json-logic-js": "^2.0.2", "json-logic-js": "^2.0.2",
"zustand": "^4.4.7", "zustand": "^4.4.7",
"@uidotdev/usehooks":"^2.4.1", "@uidotdev/usehooks":"^2.4.1",
"webpack-preprocessor-loader": "^1.3.0" "webpack-preprocessor-loader": "^1.3.0",
"preact": "^10.19.3"
}, },
"babel": { "babel": {
"presets": [ "presets": [

File diff suppressed because one or more lines are too long

View File

@ -36,6 +36,12 @@ module.exports = {
}, },
resolve: { resolve: {
extensions: ['.tsx', '.ts', '.js', '.jsx'], extensions: ['.tsx', '.ts', '.js', '.jsx'],
"alias": {
"react": "preact/compat",
"react-dom/test-utils": "preact/test-utils",
"react-dom": "preact/compat", // Must be below test-utils
"react/jsx-runtime": "preact/jsx-runtime"
},
}, },
//devtool: "inline-source-map", //devtool: "inline-source-map",
//mode: "development" //mode: "development"