Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: flatten module return function when module default is function #538

Conversation

unformalized
Copy link
Contributor

Description

remote client use shared module like dayjs which export default a function, will get a type error: xxx is not function
flattenModule function return object or not a function when module default export is function

fix issue 537

Additional context


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Code of Conduct and follow the Commit Convention guidelines.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@ruleeeer
Copy link
Collaborator

ruleeeer commented Nov 18, 2023

It looks like this change was made to keep webpack and rollup's exports of CJS libraries consistent. Would such a change cause other lib problems?

@bustEXZ
Copy link
Contributor

bustEXZ commented Nov 18, 2023

The problem is that at the assembly level, shared does not know what is ultimately there, and if there is a function in the module, it does not change dayjs() to dayjs.default(), the same with clsx

@ruleeeer ruleeeer merged commit d60c019 into originjs:main Nov 20, 2023
9 checks passed
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.

4 participants