Skip to content

Handling exported functions #984

Closed
Closed
@yungvldai

Description

@yungvldai

Hi! First of all thank you for your work!

Modification Proposal

I came across an interesting case in which a custom (modified) css-loader exports functions (as named exports).
The current implementation uses JSON.stringify, which causes export values of type function ​​to become undefined. It seems that we can fix this behavior quite easily without breaking anything by adding a check for typeof === 'function' and calling (locals)[key].toString() instead of JSON.stringify((locals)[key]).

What do you think?

Expected Behavior / Situation

Function code is inserted instead of undefined

Actual Behavior / Situation

Function code turns into undefined

Please paste the results of npx webpack-cli info here, and mention other relevant information

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions