Description
Description
If you export a non-function member from an LWC-ES6-Module and then use the module in an Aura context, it gets converted into a function, which is not executable. It doesn't have its intended value and you cannot execute the "function" to get the value.
This also makes aggregation of modules to object members impossible.
If you use the module in another LWC and import it normally through the name of the named export, it works. Only the Aura context wont work due to the conversion
Steps to Reproduce
- Build a LWC module (base) and an extra file (specific utils) and populate it with any named exports
- In the base file, try to export everything from the extra file
HINT: You may also export a basic const member from the main file to view the issue
// Appears as non-executable function in Aura context
export const testMember = 'Lel';
// Both this way...
import * as sortUtils from './sortUtils';
export { sortUtils };
// ...as well as this way converts to function
export * as sortUtils from './sortUtils';
// This way works for functions, but no other member types
export * from './sortUtils';
Expected Results
The exported members have their respective values and are useable in Aura context
Actual Results
Variables or objects get converted into these strange functions and values are lost.
Browsers Affected
Tested with Chrome
Version
- API Version: 51.0
Additional context/Screenshots
Console logging the imported LWC module in Aura (by component.find('utils')) gives:
Console logging the sortUtils member in another LWC gives the correct output:
Activity