You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm attempting to use ReactJS in a project, with browserify. While I can hit http://localhost/assets/react.js and get a file, I get an error when I require('react').
-- Test1.js (breaks with 'module "react" not found')
var react = require('react')
-- Test0.js (works... ish... React is a global, not available from require())
// = require react
I AM able to get browserify to work if I give the full path to the file. OBVIOUSLY this only works in development, on my machine.
-- Test2.js
var react = require('/home/dusty/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/react-source-0.10.0/build/react.js');
I'm fairly certain that the config you provide will allow me to load the file, but I'm stumped as to what magic incantation can load files from a gem. I tried to build a shim in my assets directory that //= require react, but while the first file gets processed by sprockets, secondary dependencies don't.
The text was updated successfully, but these errors were encountered:
I think, the easiest solution is to install react via npm with npm install --save react. This will install it into the node_modules directory, from where you can require it.
I'm attempting to use ReactJS in a project, with browserify. While I can hit http://localhost/assets/react.js and get a file, I get an error when I require('react').
I AM able to get browserify to work if I give the full path to the file. OBVIOUSLY this only works in development, on my machine.
I'm fairly certain that the config you provide will allow me to load the file, but I'm stumped as to what magic incantation can load files from a gem. I tried to build a shim in my assets directory that //= require react, but while the first file gets processed by sprockets, secondary dependencies don't.
The text was updated successfully, but these errors were encountered: