I'm trying to get started using BroccoliJS to build apps using the React framework. I'm trying to use browserify to combine the javascript files I'm using but it keeps returning errors when I try to run the build on a barebones application. I have a directory structure something like
|--app
|--index.js
|--index.html
|--node_modules
|--react
|--public
|--styles
|--app.scss
|--Brocfile.js
|--package.json
My brocfile is something like
/* Brocfile.js */
var compileSass = require('broccoli-sass');
var funnel = require('broccoli-funnel');
var mergeTrees = require('broccoli-merge-trees');
var browserify = require('broccoli-browserify');
var javascript = funnel('app', {
srcDir: '/'
});
var styles = funnel('styles', {
srcDir: '/'
});
var appJs = browserify(javascript, {
entries: ['index.js'],
outputFile: 'app.js',
transform: ['reactify']
});
var appCss = compileSass([styles], 'app.scss', 'application.css');
module.exports = mergeTrees([appJs, appCss]);
The problem is I keep getting errors to the effect of Cannot find module 'app.js'
.
I'm not overly picky about how I end up compiling the project since I don't know much about any of the tools I'm using yet, but I would like to use Broccoli if possible. Would anyone have a moment to point me in the right direction to get this working? Thank you.
EDIT:
If it helps, this is what app.js looks like.
var React = require('react');
var App = React.createClass({
render: function() {
return (
<div>
<h1>TEST</h1>
</div>
);
}
});
React.render(<App />, document.getElementById('app'));