Skip to content

Non-Function members exported in LWC module get converted to non-executable functions in Aura context #2397

Open
@hgebker

Description

@hgebker

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

  1. Build a LWC module (base) and an extra file (specific utils) and populate it with any named exports
  2. 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:
image

Console logging the sortUtils member in another LWC gives the correct output:
image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions