andreypopp/reactify

v 0.17.1 Unexpected token

Closed this issue · 2 comments

/* package.json */
{
  "scripts": {
    "watch": "watchify src/app.js -o public/js/scripts.js",
    "build": "browserify src/app.js -o public/js/scripts.js",
  },
  "dependencies": {   
    "react": "~0.12"
  },
  "devDependencies": {
    "browserify": "~6.0.3",
    "reactify": "~0.17",
    "watchify": "~2.1",
  },
  "browserify": {
    "transform": [ "reactify" ]
  }
}
// src/app.js
/** @jsx React.DOM */

var React = require('react'),
    Form = require('app/component/form.react');

var initial = { number: 25 };

React.render( <Form init={initial} /> , '#mount-point');
// src/component/form.react.js
/** @jsx React.DOM */

var React = require('react');

//noinspection JSUnusedGlobalSymbols
module.exports = Form = React.createClass({
    getInitialState: function() {
        return this.props.init;
    },
    onInputChange: function(ev) {
        console.log(ev);
    },
    render: function() {
        return (
            <form method="post">
                <label htmlFor="number">
                    <input
                        name="number"
                        id="number"
                        type="text"
                        value={this.state.number}
                        onChange={this.onInputChange}/>
                </label>
            </form>
        );
    }
});

Note: i have a symlink src/ dir to node_modules/app
always i get Error: Parsing file /home/rkmax/Development/project/src/component/form.react.js: Unexpected token (15:12)

Currently i have a symlink to node_modules/app from my src/ for avoid relatives paths in my project but if a replace the line

if a replace Form = require('app/component/form.react'); by Form = require('./component/form.react'); works. but i dont want relative import in my project :(

dup of #38