Skip to content

Commit cd8d658

Browse files
Merge pull request #3061 from preactjs/compat-server-export
2 parents c6ca49e + 19885d3 commit cd8d658

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

compat/server.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
/* eslint-disable */
22
var renderToString;
33
try {
4-
renderToString = dep(require('preact-render-to-string'));
4+
const mod = require('preact-render-to-string');
5+
renderToString = mod.default || mod.renderToString || mod;
56
} catch (e) {
67
throw Error(
78
'renderToString() error: missing "preact-render-to-string" dependency.'
89
);
910
}
1011

11-
function dep(obj) {
12-
return obj['default'] || obj;
13-
}
14-
1512
module.exports = {
1613
renderToString: renderToString,
1714
renderToStaticMarkup: renderToString

compat/server.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
export { renderToString, renderToStaticMarkup } from 'preact-render-to-string';
1+
export {
2+
renderToString,
3+
renderToString as renderToStaticMarkup
4+
} from 'preact-render-to-string';

0 commit comments

Comments
 (0)