Repository navigation
fix: load ESM generators via dynamic import() + bump to generator ESM majors (APPBLD-4615) - #937
Merged
AnujVishwakarma-src merged 2 commits intoSep 24, 2026
Conversation
… majors (APPBLD-4615)
The generator packages are now ESM-only. aio-cli-plugin-app stays CommonJS but
must load them via dynamic import() instead of require():
- src/commands/app/init.js (runCodeGenerators), add/ci.js, delete/ci.js:
require('@adobe/generator-aio-app') / require('@adobe/generator-app-common-lib')
-> await import(...) inside the async methods (.default for generator-aio-app).
- Bumps generator-aio-app ^9 -> ^10 and generator-app-common-lib ^3 -> ^4.
yeoman-environment is already loaded via dynamic import() (create-yeoman-environment.js).
No ESM conversion of the plugin itself; env.instantiate() runs the imported ESM
generator classes unchanged. Affected command test suites pass (65/65).
Depends on @adobe/generator-aio-app@10 being published.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
generator-aio-app@10 is ESM-only; the top-level require() in the test threw 'Must use import to load ES Module' once 10.0.0 published. Load it via import() in beforeAll, matching the command's runtime load. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
AnujVishwakarma-src
marked this pull request as ready for review
September 16, 2026 06:04
Contributor
Author
|
/upload-coverage |
Contributor
|
Coverage artifact not found. Re-run CI first, then comment |
Contributor
Author
|
/upload-coverage |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
L4 — consume the ESM generator fleet (aio-cli-plugin-app stays CommonJS)
The generator packages are now ESM-only. This plugin is not converted to ESM — it loads them via dynamic
import()instead ofrequire():src/commands/app/init.js(runCodeGenerators),add/ci.js,delete/ci.js:require('@adobe/generator-aio-app')/require('@adobe/generator-app-common-lib')→await import(...)inside the async methods (.defaultfor generator-aio-app). PreventsERR_REQUIRE_ESM.yeoman-environmentis already loaded via dynamicimport()(create-yeoman-environment.js);env.instantiate()runs the imported ESM generator classes unchanged.Validation: the affected command suites (init / add-ci / delete-ci) pass 65/65 against a local link to the ESM
generator-aio-app+ publishedgenerator-app-common-lib@4.0.0. Lint clean.NOTE: the
tarCRITICAL (viayeoman-environment@4 → node-gyp@10 → tar@6.2.1) is intentionally not in this PR — it needs ayeoman-environment ^4→^6/7API-major bump and will be a separate focused PR.Pre-merge validation (2026-09-24)
Re-validated end-to-end on the PR branch with
aio-cli 11.1.4+ this plugin-app branch linked (aio plugins link) +aio-cli-plugin-app-templates@2.1.4linked, Node 26. Each of the 3 converted files is exercised through a realaiocommand (not just unit mocks).npm test(init / add-ci / delete-ci suites included)generator-aio-app10.1.0, hub 4.1.0, bothtype: module(ESM)import()from plugin-app contextERR_REQUIRE_ESM/ no "constructor is not a constructor"aio app initinit.jsrunsgenerator-aio-app@10applicationgenerator viaimport()aio app add ciadd/ci.jsimport(generator-aio-app@10)→add-ciESM generatordeploy_prod/deploy_stage/pr_testworkflowsaio app delete cidelete/ci.jsimport(@adobe/generator-app-common-lib)constantsaio app add extension(excshell)Finished running template @adobe/generator-app-excshell; only a post-step login gate (Missing orgId) after the code under testyeoman-environment@4.4.3 → tar@6.2.1still presentNote on login gates:
aio app add action/add extension's org/project-config steps require a logged-in Adobe context; those gates trigger after the ESM-generator-load code under test, so they don't affect this validation.