-
-
Notifications
You must be signed in to change notification settings - Fork 37
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 #38
Comments
Correct, |
It does work in the browser, but only if How is |
Btw, we talked about this with rexxars from react-markdown already: #16 (comment)
This is indeed how it is intended: it depends on certain aspects, which are available in Node, and typically available in bundlers as well. Unless explicitly turned off.
There are several downsides for touching/changing/removing cwd, as outlined in the issue mentioned above, but also: It’s breaking. |
Understood. Thanks for the context. For our project, I've restored the Webpack |
Sweet, thanks for raising this and for understanding! Best |
Heads up that Webpack is considering removing default polyfilling, so this may become more of an issue moving forward. You might consider leaving them feedback if you have thoughts (they're asking for feedback on the decision). |
Ah thanks for mentioning that! I found an issue where other module authors already voiced my concerns. I’m interested in seeing what the actual behaviour will be: when warnings show up, we’ll address them somehow! |
@wooorm
|
In case anyone comes across this after upgrading to webpack 5, the way to shim
webpack.config.json
|
To only shim
|
This comment has been minimized.
This comment has been minimized.
the question around resolving |
Subject of the issue
The VFile constructor references
process
directly. In a vanilla browser environment, this throws an error. However, many build systems polyfillprocess
so this may have gone unnoticed in most applications --process
is mocked by default by Webpack, and Browserify does something similar.Your environment
unified@6.2.0
,vfile@2.3.0
(viareact-markdown@4.2.2
)node@10.16.0
npm@6.9.0
yarn@1.16.0
Steps to reproduce
In an environment without a global
process
object (e.g. a vanilla browser, a webpack build with theprocess
mock disabled):vfile()
, either as a standalone function (which redirects to call as a constructor) or as a constructor (new VFile()
).processor.parseFile()
Expected behaviour
The
VFile()
constructor instantiates an object.Actual behaviour
The
VFile()
constructor throws.The text was updated successfully, but these errors were encountered: