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

Commit

Permalink
Fix bug where let doesn't work in runInContext in old Node versions.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jeresig committed Mar 1, 2017
1 parent fe9b3ff commit 31a2a26
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,10 @@ const render = function(jsPackages, pathToReactComponent, props,
// our work here is easy.
return runInContext(context, () => {
return new Promise((resolve, reject) => {
let Component = KAdefine.require(global.pathToReactComponent);
// NOTE(jeresig): We should be using `let` here but the current
// version of the Node.js runtime we use in production doesn't
// understand `let` inside runInContext (known bug).
var Component = KAdefine.require(global.pathToReactComponent); // eslint-disable-line no-var

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

0 comments on commit 31a2a26

Please sign in to comment.