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

requireReturnsDefault: "auto" results in an incorrect bundle for some libraries #1716

Open
mlaponder opened this issue May 13, 2024 · 0 comments

Comments

@mlaponder
Copy link

Expected Behavior

Created bundle can be run without errors

Actual Behavior

An error occurs when the bundle is loaded:

Uncaught TypeError: (0 , _createTheme.default) is not a function
    at bundle.js:14953:92
    at bundle.js:17882:3

Additional Information

_createTheme seems to have a dubbel wrapped default, there is a default in createTheme$1 but another one is added by _interopRequireDefault. As a result _createTheme.default is not a function, but _createTheme.default.default is.

I can workaround it by specifying:

{ requireReturnsDefault: (id) => /createTheme|styled-engine|styleFunctionSx/.test(id) ? false : "auto" } 

for the commonjs plugin, but I was hoping that "auto" would take care of this. Noe that the example uses MaterialUI as an example but I have also seen it with other libraries.

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

No branches or pull requests

1 participant