Skip to content
This repository has been archived by the owner on Apr 30, 2018. It is now read-only.

React is undefined when loading React with a script tag #8

Open
ronaldborman opened this issue Jul 6, 2015 · 2 comments
Open

React is undefined when loading React with a script tag #8

ronaldborman opened this issue Jul 6, 2015 · 2 comments

Comments

@ronaldborman
Copy link

When I explore a new library, I like to use a webpage, load the library and all dependencies with script tags and write example code in a script tag.

In React-Formly 0.0.4 this setup worked, but in 0.0.5/Master I get an "Cannot read property 'createClass' of undefined" error on line 16 of Formly.js ("var Formly = React.createClass"). While the browser indicates that React is undefined, React is available on the global object (a.k.a. window).

I suspect that this is a side effect of commit e943db6. Unfortunately my knowledge of Webpack is limited, so I cannot suggest a comprehensive change.

I realize that the use case for using script tags is limited (essentially only exploration), but I think it's valid enough to include it in React Formly.

@kentcdodds
Copy link
Member

I personally think that being able to play around with it in the browser as a script tag is quite valuable and I would say it's a requirement for this library. Do you think you can make this happen @Astrism?

@ghelton
Copy link
Collaborator

ghelton commented Jul 6, 2015

Makes sense to me, I should be able to look into it soon.

On Monday, Jul 6, 2015 at 1:48 PM, Kent C. Dodds [email protected], wrote:

I personally think that being able to play around with it in the browser as a script tag is quite valuable and I would say it's a requirement for this library. Do you think you can make this happen @Astrism?


Reply to this email directly or view it on GitHub.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants