Skip to content
This repository was archived by the owner on Aug 13, 2020. It is now read-only.

Commit 31a2a26

Browse files
committed
Fix bug where let doesn't work in runInContext in old Node versions.
See: nodejs/node#2245 Test Plan: I switched my Node version back to v4 and confirmed that I was able to run `render_component.js` without error. Auditors: emily, csilvers
1 parent fe9b3ff commit 31a2a26

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/render.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,10 @@ const render = function(jsPackages, pathToReactComponent, props,
323323
// our work here is easy.
324324
return runInContext(context, () => {
325325
return new Promise((resolve, reject) => {
326-
let Component = KAdefine.require(global.pathToReactComponent);
326+
// NOTE(jeresig): We should be using `let` here but the current
327+
// version of the Node.js runtime we use in production doesn't
328+
// understand `let` inside runInContext (known bug).
329+
var Component = KAdefine.require(global.pathToReactComponent); // eslint-disable-line no-var
327330

328331
// The Component could have been exported using `export default`
329332
// We check for that case and use that component here.

0 commit comments

Comments
 (0)