bugsnag / react-inline-svg

React Component to load and inline SVG images, allowing you to target and style SVGs using CSS.
MIT License
7 stars 6 forks source link

Uncaught ReferenceError: React is not defined #2

Closed monte-hayward closed 9 years ago

monte-hayward commented 9 years ago

code

import React from 'react';
import InlineSVG from 'react-inline-svg';
// ...
<InlineSVG className="toggle" src="/public/images/video_controls_volume_icon.svg" />

Uncaught ReferenceError: React is not defined (anonymous function) @ react-inline-svg.js:45

jmshal commented 9 years ago

The library currently doesn't support CommonJS module loading, or even UMD for that matter.

@loopj Would you be alright for me to UMD this bad boy? Also, how exactly is this accomplished for Bugsnag, I was under the impression you guys use browserify/webpack?

loopj commented 9 years ago

@jacobmarshall that would be awesome, I'm not super familiar with UMD stuff so would gladly merge a PR

jmshal commented 9 years ago

Hey @monte-hayward, would you mind changing the react-inline-svg section of your package.json to something like the following - and letting me know if all is working? I just want to verify that the changes I have made, work in your setup.

{
  "dependencies": {
    "react-inline-svg": "jacobmarshall/react-inline-svg#umd"
  }
}

If you're using browserify, it should be all good, I haven't tested with webpack.

Cheers, Jacob

pcorpet commented 8 years ago

@loopj, could you do a release so we can benefit from this fix directly in NPM, please?