When I run browserify -t reactify main.js with these files:
add.js
/* @flow */
module.exports = function (x: number, y: number) : number {
return x + y;
};
main.js
/* @flow */
var add = require('./add');
console.log(add(3, 1));
I get this error:
module.exports = function (x: number, y: number) : number {
^
ParseError: Unexpected token
The JSX transform that comes with react tools v. 0.12.2 can strip out flow type annotations from this file with jsx --strip-types (not sure if later versions do this). I'm new to NPM and node, etc. so I'm not sure how to add this transform to reactify. I tried changing the react-tools field in my project's node_modules/reactify/package.json to "~0.12.2" and then ran npm build, but it didn't seem to have any effect.
Is there a way to strip out flow types with reactify? Or do I need to run jsx in a separate command before running browserify?
I figured it out from a flow example and your strip-types branch! Just need to use 0.17.0, and then I could run this: browserify -t [ reactify --strip-types ] main.js
When I run
browserify -t reactify main.js
with these files:add.js
main.js
I get this error:
The JSX transform that comes with react tools v. 0.12.2 can strip out flow type annotations from this file with
jsx --strip-types
(not sure if later versions do this). I'm new to NPM and node, etc. so I'm not sure how to add this transform to reactify. I tried changing thereact-tools
field in my project's node_modules/reactify/package.json to"~0.12.2"
and then rannpm build
, but it didn't seem to have any effect.Is there a way to strip out flow types with reactify? Or do I need to run
jsx
in a separate command before runningbrowserify
?