Skip to content
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 some react libraries #861

Open
hatemhosny opened this issue Aug 12, 2024 · 0 comments
Open

Failed to import some react libraries #861

hatemhosny opened this issue Aug 12, 2024 · 0 comments
Labels
browser Not working in Browser

Comments

@hatemhosny
Copy link

Thank you for such a great project.

I noticed that importing some react libraries fails with such errors:

Uncaught TypeError: Cannot read properties of null (reading 'useState')

Examples for failing modules

I tried these code snippets (from official websites of packages) in the playground and they give the same errors

import React from 'https://esm.sh/react'
import { Tldraw } from 'https://esm.sh/tldraw'
// import 'tldraw/tldraw.css'

export default function () {
	return <Tldraw />
}
import React from 'https://esm.sh/react';
import { ReactFlow } from 'https://esm.sh/@xyflow/react';
 
// import '@xyflow/react/dist/style.css';
 
const initialNodes = [
  { id: '1', position: { x: 0, y: 0 }, data: { label: '1' } },
  { id: '2', position: { x: 0, y: 100 }, data: { label: '2' } },
];
const initialEdges = [{ id: 'e1-2', source: '1', target: '2' }];
 
export default function App() {
  return (
    <div style={{ width: '100vw', height: '100vh' }}>
      <ReactFlow nodes={initialNodes} edges={initialEdges} />
    </div>
  );
}

Additional info

  • esm.sh version: latest (135)
  • Browser version: latest chrome
@hatemhosny hatemhosny added the browser Not working in Browser label Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
browser Not working in Browser
Projects
None yet
Development

No branches or pull requests

1 participant