vscode-javascript-repl-docs icon indicating copy to clipboard operation
vscode-javascript-repl-docs copied to clipboard

Can't seem to make it work as NodeJS REPL inside Gatsby project

Open fmaiabatista opened this issue 4 years ago • 3 comments

Hi, I'm new to the plugin and can't seem to make it work as NodeJS REPL.

I run the command JS REPL: New Javascript File (.js), it creates an Untitled-1.js (unsaved) file in my workspace and no matter what content I have inside the file it says there's an error with Babel in the first line...

I've tried including NODE_ENV=test in it but nothing I tried made it work.

Please refer to the screenshot for the context: image

fmaiabatista avatar Jun 18 '21 12:06 fmaiabatista

Hey, @fmaiabatista thank you so much for your feedback and I am sorry that you had this issue.

Basically, the repl uses by default a runtime context created on the same process. I chose to have this by default because this is "lighter" compared to use a separate process but it has some issues when users are running-testing code through repl specifically for node.js.

The truth is that I have not tested the extension inside a Gatsby project but I think that by using the 'Node' option instead of the default 'VM' on the "JavaScript-repl: Context" option in vscode preferences-settings, maybe your example will work successfully.

Please, let me know if you change this option on settings, your example will work.

axilleasiv avatar Jun 22 '21 09:06 axilleasiv

Hi @axilleasiv, thanks for your response.

Unfortunately it doesn't work even after changing the mentioned option (I have also tried reloading VS Code after changing the setting just in case): image

For the time being I'm using the NodeJS REPL which from what I read is used in this extension as base for the functionality, but there I get no errors 🤷‍♂️

fmaiabatista avatar Jun 23 '21 14:06 fmaiabatista

Hi @fmaiabatista, thank you again for your feedback. I will keep this issue open and I will investigate further this.

Based on your previous message, I think that this has to do with the babel-preset-gatsby module and the internal version that the JS repl extension uses.

I will let you know.

axilleasiv avatar Jun 24 '21 19:06 axilleasiv