Skip to content

feat!: make package pure ESM#69

Merged
chenjiahan merged 4 commits into
mainfrom
chenjiahan/feat-pure-esm
Jun 1, 2026
Merged

feat!: make package pure ESM#69
chenjiahan merged 4 commits into
mainfrom
chenjiahan/feat-pure-esm

Conversation

@chenjiahan

@chenjiahan chenjiahan commented Jun 1, 2026

Copy link
Copy Markdown
Member

This PR makes @rspack/plugin-preact-refresh a pure ESM package. It removes the CommonJS wrapper, main, and exports.require, switches Rslib to ESM-only output with ES2023 syntax, and exposes the root package through the default condition.

The README now shows ESM config usage, and the test fixtures read the ESM default export from the built package under Node 24.

@chenjiahan chenjiahan marked this pull request as ready for review June 1, 2026 06:15
Copilot AI review requested due to automatic review settings June 1, 2026 06:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR converts @rspack/plugin-preact-refresh into a pure ESM package by removing the CommonJS entrypoint/exports, switching the build output to ESM-only, and updating docs/tests to consume the plugin via ESM default export semantics.

Changes:

  • Remove the CommonJS wrapper (index.cjs) and drop exports.require from package.json.
  • Configure Rslib to emit only ESM + DTS outputs.
  • Update README and test fixtures to use ESM-style default export consumption.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/hotCases/with-worker/basic/rspack.config.js Update fixture to read the plugin as an ESM default export via require() interop.
test/hotCases/jsx/with-same-name-component/rspack.config.js Update fixture to read the plugin as an ESM default export via require() interop.
test/hotCases/jsx/value/rspack.config.js Update fixture to read the plugin as an ESM default export via require() interop.
test/hotCases/jsx/child/rspack.config.js Update fixture to read the plugin as an ESM default export via require() interop.
test/hotCases/jsx/basic/rspack.config.js Update fixture to read the plugin as an ESM default export via require() interop.
test/hotCases/hook/useState_reset/rspack.config.js Update fixture to read the plugin as an ESM default export via require() interop.
test/hotCases/hook/useState_keep/rspack.config.js Update fixture to read the plugin as an ESM default export via require() interop.
test/hotCases/hook/useContext_provide/rspack.config.js Update fixture to read the plugin as an ESM default export via require() interop.
test/hotCases/hook/useContext_keep/rspack.config.js Update fixture to read the plugin as an ESM default export via require() interop.
test/hotCases/hook/useContext_initial/rspack.config.js Update fixture to read the plugin as an ESM default export via require() interop.
test/configCases/condition/include/rspack.config.js Update fixture import pattern and adjust plugins formatting.
test/configCases/condition/exclude/rspack.config.js Update fixture import pattern and adjust plugins formatting.
rslib.config.ts Switch library build output to ESM-only (with DTS).
README.md Update usage examples to ESM import/export style and ESM-friendly require.resolve via createRequire.
package.json Make the package pure ESM by removing CJS entrypoints/exports and updating main/exports/files.
index.cjs Remove CommonJS compatibility entrypoint.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md
@chenjiahan chenjiahan merged commit 20c3be2 into main Jun 1, 2026
4 checks passed
@chenjiahan chenjiahan deleted the chenjiahan/feat-pure-esm branch June 1, 2026 06:40
@chenjiahan chenjiahan changed the title feat: make package pure ESM feat!: make package pure ESM Jun 1, 2026
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.

2 participants