Skip to content

feat: support ES module plugins - #5820

Open
stevenjoezhang wants to merge 1 commit into
masterfrom
agent/support-esm-plugins
Open

feat: support ES module plugins#5820
stevenjoezhang wants to merge 1 commit into
masterfrom
agent/support-esm-plugins

Conversation

@stevenjoezhang

Copy link
Copy Markdown
Member

What does it do?

Adds native ES module plugin loading for .mjs entries and .js entries in packages with "type": "module".

ES module plugins export a default initializer that receives the Hexo instance:

export default async function initialize(hexo) {
  // register extensions
}

The existing CommonJS vm loading path remains unchanged.

Closes #5525.

Validation:

  • Loader tests pass on Node.js 20.19.0 (19 passing).
  • ESLint passes for the changed files.
  • TypeScript build passes.

Screenshots

Not applicable.

Pull request tasks

  • Add test cases for the changes.
  • Passed the CI test.

@github-actions

Copy link
Copy Markdown

How to test

git clone -b agent/support-esm-plugins https://github.com/hexojs/hexo.git
cd hexo
npm install
npm test

@stevenjoezhang
stevenjoezhang marked this pull request as ready for review August 12, 2026 18:45
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

Successfully merging this pull request may close these issues.

Support to load ES module plugin

1 participant