JSX in modules isn't transformed
JedWatson opened this issue · 1 comments
I'm not sure if this is something that can be resolved, but wanted to report it in case. Might be a browserify issue, or configuration option I've missed ...?
I'm developing a generic UI control in React, and just moved it out of my project and into its own package - which I've published to npm, and am continuing to develop using npm link
.
Unfortunately, as soon as my code is inside the node_modules
folder, it stops being transformed, and I start getting errors. (It still has the /** @jsx React.DOM */
pragma at the start of the file)
It seems I can work around this by either
- Transforming the JSX in my package independently
- Not using JSX in my packages
Both are doable but it would be nice if I could just use my existing workflow to transform everything I'm including, regardless of whether it's in my project or a package.
Sorry, just after I opened this issue I found the { global: true }
option you can pass to the transform
method, which solves the problem.
For reference, if you want to parse JSX in modules using browserify's API, this works:
browserify()
.add(/* ... */)
.transform({ global: true }, reactify)