react-web-component icon indicating copy to clipboard operation
react-web-component copied to clipboard

TypeError: Cannot read property 'create' of undefined

Open Darth-Alex opened this issue 5 years ago • 3 comments

Error in Chrome trying to create a web-component with react and typescript

index.tsx:5 Uncaught TypeError: Cannot read property 'create' of undefined at Object. (index.tsx:5) at n (bootstrap:19) at bootstrap:83 at header-component.min.js:1

i built a simple component:

import * as React from 'react';

export const HeaderComponent = () => {
  return <div>Header Component</div>;
};

and a index.tsx

import * as React from 'react';
import ReactWebComponent from 'react-web-component';
import { HeaderComponent } from './headercomponent';

ReactWebComponent.create(<HeaderComponent />, 'header-component');

i built it with webpack and the awesome-typescript-loader

this is my html file

<!DOCTYPE html>
<html lang="en">
  <head>
    <title></title>
    <script src="header-component.min.js"></script>
  </head>
  <body>
    <header-component></header-component>
  </body>
</html>

Is there Support for Typescript available?

Darth-Alex avatar Dec 13 '19 17:12 Darth-Alex

Did you find a solution to this in the end? I'm having the same issue.

anthonymayfield avatar May 12 '20 07:05 anthonymayfield

Same here

pinkbunny1 avatar Jun 17 '20 07:06 pinkbunny1

I'm having the same problem

andreamike avatar Jul 04 '20 11:07 andreamike