Skip to content

fix: support named export for cjs#35

Merged
chenjiahan merged 2 commits intomainfrom
fix-export
May 12, 2025
Merged

fix: support named export for cjs#35
chenjiahan merged 2 commits intomainfrom
fix-export

Conversation

@hardfist
Copy link
Copy Markdown
Contributor

@hardfist hardfist commented May 12, 2025

default export is very fragile in esm-cjs interop, so will be deprecated in future version and only support the following exports in future which can be used in following case

  • native esm import: it will just use the index.mjs's export { ReactRefreshRspackPlugin}
  • esm transpiled to cjs: will use module.exports.ReactRefreshRspackPlugin = ReactRefreshRspackPlugin
  • native cjs: have to write const ReactRefreshRspackPlugin = require('ReactRefreshRspackPlugin');
import { ReactRefreshRspackPlugin } from '@rspack/plugin-react-refresh';

Copy link
Copy Markdown
Member

@chenjiahan chenjiahan left a comment

Choose a reason for hiding this comment

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

@chenjiahan chenjiahan merged commit 4e8802e into main May 12, 2025
4 checks passed
@chenjiahan chenjiahan deleted the fix-export branch May 12, 2025 02:24
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