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
Contributor

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/[email protected]/+esm",
"memoize-one": "https://cdn.jsdelivr.net/npm/[email protected]/+esm",
"emotion":"https://cdn.jsdelivr.net/npm/@emotion/[email protected]/+esm",
"preact": "https://cdn.jsdelivr.net/npm/[email protected]/+esm",
"prop-types": "https://cdn.jsdelivr.net/npm/[email protected]/+esm",
"classnames": "https://cdn.jsdelivr.net/npm/[email protected]/+esm",
"diff": "https://cdn.jsdelivr.net/npm/[email protected]/+esm",

     "@r2wc/react-to-web-component": "https://cdn.jsdelivr.net/npm/[email protected]/+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