-
-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to import - lodash #937
Comments
Is there a way to substitute a dependency, aka lodash-es for lodash? |
it's look ok? @Kreijstal <html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Demo</title>
<script type="module" async>
import React from "https://esm.sh/react@18";
import ReactDOM from "https://esm.sh/react-dom@18";
async function initialize() {
let { Workbook } = await import(
"https://esm.sh/@fortune-sheet/react?deps=react@18,react-dom@18"
);
console.log(Workbook);
ReactDOM.createRoot(
document.getElementById("root")
).render(
React.createElement(Workbook, { data: [{ name: "Sheet1" }] })
);
}
window.onload = initialize;
</script>
</head>
<body>
<div id="root"></div>
</body>
</html> |
@knoxnoe How did you manage to make it work? when using ReactDOM I get an error using firefox, does it work for you on this website as well? https://observablehq.com/d/37ef873372b7f3e4 |
copy this code in an *.html file,and then open it in your local browser
i'll take a look later |
also use the following css |
Failing module
Error message
After
onload
I got this:Additional info
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
The text was updated successfully, but these errors were encountered: