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 - preact/hooks correct version of create-context.js Uncaught TypeError: Cannot read properties of undefined (reading '__H') #567

Closed
pankgeorg opened this issue Mar 26, 2023 · 4 comments
Labels
browser Not working in Browser

Comments

@pankgeorg
Copy link

Failing module

image

// @ts-nocheck
import {
    //
    render,
    Component,
    h,
    cloneElement,
    createContext,
    createRef,
    hydrate,
} from "https://esm.sh/v66/[email protected]?target=es2020"
import {
    //
    useEffect,
    useLayoutEffect,
    useState,
    useRef,
    useMemo,
    useCallback,
    useContext,
    useErrorBoundary,
} from "https://esm.sh/v66/[email protected]/hooks?target=es2020"

import htm from "https://esm.sh/v66/[email protected]?target=es2020"

const html = htm.bind(h)

export {
    //
    html,
    render,
    Component,
    useEffect,
    useLayoutEffect,
    useState,
    useRef,
    useMemo,
    useCallback,
    useErrorBoundary,
    createContext,
    createRef,
    useContext,
    h,
    cloneElement,
    hydrate,
}

Error message

After onload I got this:

Uncaught TypeError: Cannot read properties of undefined (reading '__H')
    at a (index.js:385:43)
    at q (index.js:385:43)
    at F (index.js:385:43)
    at E.EditorLoader [as constructor] (editor.js:136:76)
    at E._e [as render] (create-context.js:3:16)
    at M (create-context.js:3:16)
    at z (create-context.js:3:16)
    at M (create-context.js:3:16)
    at oe (create-context.js:3:16)
    at PlutoEditorComponent.connectedCallback (editor.js:196:9)

Additional info

  • esm.sh version: 66
  • Browser version: Google Chrome (Windows 11) 111.0.5563.111 (Official Build) (64-bit) (cohort: Stable)
@pankgeorg pankgeorg added the browser Not working in Browser label Mar 26, 2023
@pankgeorg pankgeorg changed the title Failed to import - Failed to import - preact/hooks correct version of create-context.js Uncaught TypeError: Cannot read properties of undefined (reading '__H') Mar 26, 2023
@ije
Copy link
Member

ije commented Mar 26, 2023

Screenshot 2023-03-27 at 02 37 43

Screenshot 2023-03-27 at 02 38 07

@ije
Copy link
Member

ije commented Mar 26, 2023

sorry the v112 changed the module entry name to make you import multiple preact instances, i just added the 301 redirect to those broken modules. it should work fine now. please try again

@pankgeorg
Copy link
Author

Seems to work ok, thanks!!

@ije
Copy link
Member

ije commented Mar 27, 2023

better pin to v113

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

2 participants