preact-missing-hooks
Version:
A lightweight, extendable collection of missing React-like hooks for Preact — plus fresh, powerful new ones designed specifically for modern Preact apps.
22 lines (21 loc) • 519 B
JavaScript
;
/**
* Auto-detect Preact vs React and re-export the matching build.
* Used for require('preact-missing-hooks') in Node / CJS bundlers.
*/
function detect() {
try {
require.resolve("preact");
return require("./index.js");
} catch (_) {
try {
require.resolve("react");
return require("./react.js");
} catch (_) {
throw new Error(
"preact-missing-hooks: Install either \"preact\" or \"react\" in your project."
);
}
}
}
module.exports = detect();