plop icon indicating copy to clipboard operation
plop copied to clipboard

[node-plop] Can't use node-plop inside vscode extension

Open Stun3R opened this issue 2 years ago • 6 comments

Hi 👋🏼

I'm trying to do a vscode-extension which generate components based on a plopfile.js that I usefor a plop CLI.

As it is mandatory to do it programmatically, I use node-plop but each time I test the extension I get the following error:

require() of ES Module from not supported. Instead change the require of index.js in... to a dynamic import() which is available in all CommonJS modules. with the path pointing to node-plop.

I did some research about it & it looks like as VSCode is based on electron & they don't support ESM package only. https://github.com/microsoft/vscode/issues/130367

Maybe I'm missing something out of the box and would be glad to have your thought on it 🙏🏼

Stun3R avatar Feb 18 '23 15:02 Stun3R

@Stun3R have you figured a solution to this?

ashish-gawali-adi avatar Oct 13 '23 14:10 ashish-gawali-adi

@amwmedia would it be possible to know if there a version of node-plop that is CommonJS module and can be used in VSCode extension.

ashish-gawali-adi avatar Oct 13 '23 15:10 ashish-gawali-adi

@ashish-gawali-adi do not tag individual maintainers.

There is no node-plop CJS release.

crutchcorn avatar Oct 13 '23 16:10 crutchcorn

Sorry for that.

Thank you for the answer.

ashish-gawali-adi avatar Oct 13 '23 16:10 ashish-gawali-adi

jumping on this thread, I am having the issue and it's works fine for 0.26.1 but for any version above I got the same error. Is there any manage change that went in from 0.26.* to the current version 0.32.*?

ebouJ avatar Apr 26 '24 01:04 ebouJ

Nop, I didn't fixed it as there is no CJS release. But it might be good to have one I assume

Stun3R avatar Jun 07 '24 17:06 Stun3R