-
Notifications
You must be signed in to change notification settings - Fork 389
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
ReferenceError: process is not defined (Docusaurus) #66
Comments
this is strange, feels like the error is coming from this line: https://github.com/codesandbox/sandpack/blob/main/sandpack-client/src/client.ts#L91 but that should be solved by the bundler?! Not familiar with docusaurus, this happens at build time? |
So, i spent some time around this. And here are some of the observations. This should be handled in many ways, but the first solution is the best way to do it imo. Solution First @codesandbox/codesandbox-client is using
I tried making the existing
So, currently these are all the things, if Here is the fork of the example above Docusaurus plugin for polyfills |
wow, nice research @JayaKrishnaNamburu! thanks for taking the time! On our side we can remove the usage of process in |
Yes, the issue still exists with |
I feel like this is almost impossible, since a lot of libraries rely on env variables, even just for checking NODE_ENV |
Yes, yes. So, for the moment polyfilling is the right way to solve those problems. Unless web standards come up with something for in browsers 😄 |
Here is a update, I have the working repo here https://github.com/JayaKrishnaNamburu/sandpack-docusaurus-test/tree/trail/node-polyfill Just added a new package |
None of my use cases use the editor, I use sandpack for running the preview, so I don't need codemirror. Not sure how often other people use/will use sandpack without the editor, but have you considered having the preview runner in its own separated package? |
Hey, we believe that this issue has been solved in the latest release (v0.1.13); please let me know if this bug still persists. Thanks for reporting it! |
Hi. I was testing sandpack-react with Docusaurus, but there's a fatal error as soon as I import a sandpack component:
Made a repro repo here, but it's basically the default docusaurus template with this added to
pages/index.js
:Using version
0.0.6
.The text was updated successfully, but these errors were encountered: