Skip to content
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

Uncaught ReferenceError: process is not defined while calling validateSharedProps$1 method #134

Closed
daihuaye opened this issue Feb 12, 2019 · 3 comments
Labels
💬 question Further information is requested

Comments

@daihuaye
Copy link

Not sure there is any template for reporting a bug.

Loading my application in a server which is not running Node. And in the Chrome DevTool, the react-window stop working because the process is not defined.

It will be better not to assume process is predefined in the environment. And it's not defined, it should be always in production mode?

Please let me know if it need more info for it. Or I can push a PR to adjust this issue.

@TrySound
Copy link
Contributor

process.env.NODE_ENV is a convention which usually works on node out of the box and requires replacing for browser. Webpack uses definePlugin for this and do it out of the box according set mode: "production" | "development". Rollup uses rollup-plugin-replace for this.

So you need to bundle your app before running on server. Or manually specify

global.process = {
  env: {
    NODE_ENV: 'production' // or development
  }
}

@bvaughn
Copy link
Owner

bvaughn commented Feb 12, 2019

@TrySound's comment is spot on. If enough people mention hitting this snag, I'll update the README. 😄 For now, I'll just tag it as a question!

It will be better not to assume process is predefined in the environment

I think I see where you're coming from, but from a practical standpoint– I think it's reasonable to rely on the process.env convention given that the most tooling automatically manages this.

@bvaughn bvaughn closed this as completed Feb 12, 2019
@bvaughn bvaughn added the 💬 question Further information is requested label Feb 12, 2019
@daihuaye
Copy link
Author

Thank you for the quick reply.

the most tooling automatically manages

I start the conversation because the environment variable is given from the service in the application. Secondly, the build system in the application is quite outdated. It's not convenient to use existing tool like webpack or rollup to mange.

The workaround is to manually create a global variable and assign it to the process.env.NODE_ENV. I feel that it's a bit duplicated since there is global AppContext in the app manage the environment variable. That's why I am asking this question.

It's fine to close it. It's a bit hack for the limited flexibility build system to use this library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💬 question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants