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

Support ESM #260

Closed
stropho opened this issue Mar 2, 2021 · 3 comments
Closed

Support ESM #260

stropho opened this issue Mar 2, 2021 · 3 comments

Comments

@stropho
Copy link

stropho commented Mar 2, 2021

Follow up for #148
Since 2 years ago, there have been many new things in Node such as support for ECMAScript modules
It would be great to enable ESM support, at least to some extent.

Currently plopfile exports a function. The easiest workaround 1️⃣ I can think of is for the plopfile to export a function or a promise resolving a function. Then the plopfile could look like

module.exports = import('./my-esm-plopfile.mjs')

2️⃣ Another more robust solution could be

Plop.launch({
	// configPath: argv.plopfile,
	config: thePlopfileFunctionItself
}, run);

But after having a brief look on node-plop, it seems that this way would be more complicated, most likely a breaking change, because configPath is not used only for loading the plopfile 🤔

3️⃣ I'm sure there are other options as well 😄

What do you think, are the ES modules something worth supporting in plop ?

@crutchcorn
Copy link
Member

This is 100% something we need to look into. To be honest, I am strongly considering migrating plop and node-plop itself into full ESM after some stabilization efforts (to make sure we don't break anything in the process)

@crutchcorn
Copy link
Member

PlopJS 3 is releasing this Saturday, with ESM support!

It's stable and has a changelog today ( #293 ) but won't be launched until Saturday so that, in the event something goes wrong, I can support immediately.

@crutchcorn
Copy link
Member

ESM modules in Plop are now supported as-of Plop 3!

https://github.com/plopjs/plop/releases/tag/v3.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants