Skip to content

Failed to import - lodash #937

Open
Open
@Kreijstal

Description

@Kreijstal

Failing module

  let { Workbook } = await import(
    "https://esm.sh/@fortune-sheet/react?deps=react@18,react-dom@18"
  );
  let root = document.createElement("div");
  ReactDOM.render(
    React.createElement(Workbook, { data: [{ name: "Sheet1" }] }),
    root
  );

Error message

After onload I got this:

TypeError: (intermediate value).values is not a function

Additional info

  • Browser info: firefox

So the issue is the following, module imports https://esm.sh/v135/[email protected]/es2022/lodash.mjs which conditionally checks if Window is defined, if it is, instead of exporting Loadsh, it exports an empty object, and writes _ on "window". Of course since esm.sh rewrites _ into R, R becomes an object, so it attempts to call R.values, which is not a function..

demo

Metadata

Metadata

Assignees

No one assigned

    Labels

    browserNot working in Browser

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions