You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the transformation unconditionally unwraps the default property of exports if present. I use a library which assumes that require() returns an object with a default property and it is failing because the code ends up double-unwrapping which produces an undefined value.
AFAIK, unwrapping the default export is not part of the require expected behavior.
React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined.
Given the require semantics I think this should be considered a bug,. The default behavior should not automatically unwrap the default property. Maybe this behavior could be specified through a setting.
The text was updated successfully, but these errors were encountered:
In line:
vite-plugins/packages/vite-plugin-commonjs/src/lib.ts
Line 37 in 74b73c3
the transformation unconditionally unwraps the default property of exports if present. I use a library which assumes that
require()
returns an object with a default property and it is failing because the code ends up double-unwrapping which produces an undefined value.AFAIK, unwrapping the default export is not part of the require expected behavior.
Versions
Reproduction
This is the case I am referring to specifically. In this line que component is required:
https://github.com/martinnov92/React-Splitters/blob/c9ca351426e55c41c2016c9cc1c647dd17974783/lib/Splitter.js#L20
In this line is it used:
https://github.com/martinnov92/React-Splitters/blob/c9ca351426e55c41c2016c9cc1c647dd17974783/lib/Splitter.js#L288
See that the use expects to have the default property.
Additional Details
Steps to reproduce
What is Expected?
That the transformed code be:
What is actually happening?
Which produces the error:
Given the require semantics I think this should be considered a bug,. The default behavior should not automatically unwrap the default property. Maybe this behavior could be specified through a setting.
The text was updated successfully, but these errors were encountered: