Skip to content

Commit 4c943df

Browse files
fdidronflovilmart
authored andcommitted
Allows SERVER_RENDERING flag to prevent require warnings. (#384)
1 parent 922cfb4 commit 4c943df

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ However, if you want to use a pre-compiled file, you can fetch it from [npmcdn](
1414

1515
### Using Parse on Different Platforms
1616

17-
The JavaScript ecosystem is wide and incorporates a large number of platforms and execution environments. To handle this, the Parse npm module contains special versions of the SDK tailored to use in Node.js and [React Native](https://facebook.github.io/react-native/) environments. Not all features make sense in all environments, so using the appropriate package will ensure that items like local storage, user sessions, and HTTP requests use appropriate dependencies.
17+
The JavaScript ecosystem is wide and incorporates a large number of platforms and execution environments. To handle this, the Parse npm module contains special versions of the SDK tailored to use in Node.js and [React Native](https://facebook.github.io/react-native/) environments. Not all features make sense in all environments, so using the appropriate package will ensure that items like local storage, user sessions, and HTTP requests use appropriate dependencies. For server side rendered applications, you may set the `SERVER_RENDERING` variable to prevent warnings at runtime.
1818

1919
To use the npm modules for a browser based application, include it as you normally would:
2020

src/Parse.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ var Parse = {
3030
* @static
3131
*/
3232
initialize(applicationId: string, javaScriptKey: string) {
33-
if (process.env.PARSE_BUILD === 'browser' && CoreManager.get('IS_NODE')) {
33+
if (process.env.PARSE_BUILD === 'browser' && CoreManager.get('IS_NODE') && !process.env.SERVER_RENDERING) {
3434
console.log(
3535
'It looks like you\'re using the browser version of the SDK in a ' +
3636
'node.js environment. You should require(\'parse/node\') instead.'

0 commit comments

Comments
 (0)