feat!: make package pure ESM#69
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
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 dropexports.requirefrompackage.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.
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.
This PR makes
@rspack/plugin-preact-refresha pure ESM package. It removes the CommonJS wrapper,main, andexports.require, switches Rslib to ESM-only output with ES2023 syntax, and exposes the root package through thedefaultcondition.The README now shows ESM config usage, and the test fixtures read the ESM default export from the built package under Node 24.