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

Make it work with Preact #82

Open
studentIvan opened this issue Mar 26, 2023 · 3 comments
Open

Make it work with Preact #82

studentIvan opened this issue Mar 26, 2023 · 3 comments
Labels
accepted Accepted for development enhancement New feature or request

Comments

@studentIvan
Copy link

would be very nice, because react bundle weight too much. Preact has compatible mode, but it falls with this library

@christopherjbaker christopherjbaker added the accepted Accepted for development label Mar 27, 2023
@christopherjbaker
Copy link

This is something we recently decided to explore. Can you elaborate on how it is failing? If you are familiar with Preact, do you know what features we're likely using that are causing issues?

@christopherjbaker christopherjbaker changed the title preact support Make it work with Preact Mar 27, 2023
@christopherjbaker christopherjbaker added the enhancement New feature or request label Mar 27, 2023
@mediabuff
Copy link

mediabuff commented Oct 5, 2023

Here is the error message:

react-to-webcomponent.js:4 Uncaught TypeError: Cannot read properties of undefined (reading 'createElement') at Object.mount (react-to-webcomponent.js:4:17) at [r2wc.render] (core.js:72:70) at g.connectedCallback (core.js:62:26) at diff-viewer-webc.tsx:155:16 mount @ react-to-webcomponent.js:4 [r2wc.render] @ core.js:72 connectedCallback @ core.js:62 (anonymous) @ diff-viewer-webc.tsx:155

@mediabuff
Copy link

mediabuff commented Oct 5, 2023

I use direct from CDN as ESM browser modules. My script includes as follows:
` <script type="importmap">
{
"imports": {
"preact/jsx-runtime": "https://cdn.jsdelivr.net/npm/preact-jsx-runtime@1.2.0/+esm",
"memoize-one": "https://cdn.jsdelivr.net/npm/memoize-one@6.0.0/+esm",
"emotion":"https://cdn.jsdelivr.net/npm/@emotion/css@11.11.2/+esm",
"preact": "https://cdn.jsdelivr.net/npm/preact@10.18.1/+esm",
"prop-types": "https://cdn.jsdelivr.net/npm/prop-types@15.8.1/+esm",
"classnames": "https://cdn.jsdelivr.net/npm/classnames@2.3.2/+esm",
"diff": "https://cdn.jsdelivr.net/npm/diff@5.1.0/+esm",

     "@r2wc/react-to-web-component": "https://cdn.jsdelivr.net/npm/react-to-webcomponent@2.0.0/+esm"

   }
 }

</script>`

`import * as React from 'preact';
import * as ReactDOM from 'preact';

import ReactDiff, { DiffMethod } from './lib/index.js';

import r2wc from "@r2wc/react-to-web-component";`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Accepted for development enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants