Skip to content

Commit

Permalink
Add backwards compat for compat/server commonjs entry
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinhagemeister committed Mar 14, 2021
1 parent a40ed70 commit 19885d3
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions compat/server.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
/* eslint-disable */
var renderToString;
try {
renderToString = dep(require('preact-render-to-string'));
const mod = require('preact-render-to-string');
renderToString = mod.default || mod.renderToString || mod;
} catch (e) {
throw Error(
'renderToString() error: missing "preact-render-to-string" dependency.'
);
}

function dep(obj) {
return obj['default'] || obj;
}

module.exports = {
renderToString: renderToString,
renderToStaticMarkup: renderToString
Expand Down

0 comments on commit 19885d3

Please sign in to comment.