How can I use django-pipeline for JSX with browserify?

Issue

I am setting up the asset pipeline for a new project. We already use React.js along with webpack in a gulp-based build system and would like to use React for the new project as well. Now, since the application is written in django, I would like to port the pipeline to django-pipeline.

Ok, I can replace webpack with pipeline-browserify, and there’s also PyReact for jsx compiling. But I am unable to pipe my jsx files first through the JSX compiler and then to browserify. As far as I can tell, there is just a single compiler stage with django-pipeline. Or am I missing something? Please tell me I’m wrong…

Thanks!

Solution

My quick way for dealing with this was just to also use the reactify plugin for browserify and adding PIPELINE_BROWSERIFY_ARGUMENTS = ‘-t reactify’ to my Django settings.

Django-pipeline does support putting multiple compilers, though in my particular case, since I’ve used browserify more than django-pipeline, I used the single browserify compiler instead.

Answered By – Alex T

Answer Checked By – Marie Seifert (AngularFixing Admin)

Leave a Reply

Your email address will not be published.