Skip to content

Commit

Permalink
Merge pull request #3061 from preactjs/compat-server-export
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinhagemeister authored Mar 14, 2021
2 parents c6ca49e + 19885d3 commit cd8d658
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 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
5 changes: 4 additions & 1 deletion compat/server.mjs
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
export { renderToString, renderToStaticMarkup } from 'preact-render-to-string';
export {
renderToString,
renderToString as renderToStaticMarkup
} from 'preact-render-to-string';

0 comments on commit cd8d658

Please sign in to comment.