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

Switch from CJS (CommonJS) to ESM (ECMAScript Modules) #265

Open
JoshuaKGoldberg opened this issue Jan 24, 2025 · 0 comments · May be fixed by #269
Open

Switch from CJS (CommonJS) to ESM (ECMAScript Modules) #265

JoshuaKGoldberg opened this issue Jan 24, 2025 · 0 comments · May be fixed by #269

Comments

@JoshuaKGoldberg
Copy link
Contributor

JoshuaKGoldberg commented Jan 24, 2025

See also yeoman/yo#787: many Yeoman have generally switched from being CJS to ESM. generator-generator is still CJS, so trying to use the latest yeoman-generator or other packages results in the dreaded:

require() of ES Module /Users/josh/repos/generator-generator/node_modules/yeoman-generator/dist/index.js from /Users/josh/repos/generator-generator/app/index.js not supported.
Instead change the require of /Users/josh/repos/generator-generator/node_modules/yeoman-generator/dist/index.js in /Users/josh/repos/generator-generator/app/index.js to a dynamic import() which is available in all CommonJS modules.

This issue tracks updating generator-generator with a "type": "module" package so that it can directly import from ESM dependencies.

@JoshuaKGoldberg JoshuaKGoldberg changed the title Repo: Switch from CJS to ESM internally Switch from CJS to ESM (ECMAScript Modules) Jan 24, 2025
@JoshuaKGoldberg JoshuaKGoldberg changed the title Switch from CJS to ESM (ECMAScript Modules) Switch from CJS (CommonJS) to ESM (ECMAScript Modules) Jan 24, 2025
@JoshuaKGoldberg JoshuaKGoldberg linked a pull request Mar 20, 2025 that will close this issue
4 tasks
@JoshuaKGoldberg JoshuaKGoldberg moved this from Up Next to In Progress in Maintenance Reboot Mar 20, 2025
@JoshuaKGoldberg JoshuaKGoldberg self-assigned this Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

1 participant