Skip to content

openStackFrameInEditorMiddleware must have args when react-native>=0.… #166

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions lib/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const loadRawBodyMiddleware = require('react-native/local-cli/server/middleware/
const openStackFrameInEditorMiddleware = require('react-native/local-cli/server/middleware/openStackFrameInEditorMiddleware');
const statusPageMiddleware = require('react-native/local-cli/server/middleware/statusPageMiddleware.js');
const systraceProfileMiddleware = require('react-native/local-cli/server/middleware/systraceProfileMiddleware.js');
const reactNativeVersion = require('react-native/package.json').version;

const ENTRY_JS = '\
global.__react = require("react");\
Expand Down Expand Up @@ -145,9 +146,15 @@ class Server {
);

// Setup the express server
let args = {
projectRoots: this.projectRoots || []
};
this.server = express()
.use(loadRawBodyMiddleware)
.use(openStackFrameInEditorMiddleware)
.use(semver.lt(reactNativeVersion, '0.30.0')
? openStackFrameInEditorMiddleware
: openStackFrameInEditorMiddleware(args)
)
.use(statusPageMiddleware)
.use(systraceProfileMiddleware)
.use(cpuProfilerMiddleware)
Expand Down Expand Up @@ -298,7 +305,6 @@ class Server {
// XXX: Uses the node only invocation so we don't have to deal with bash
// as well... Fixes issues where server cannot be killed cleanly.
const cmd = 'node';
const reactNativeVersion = require('react-native/package.json').version;
const script =
semver.lt(reactNativeVersion, '0.14.0')
? ['./node_modules/react-native/packager/packager.js']
Expand Down