We are using React on Rails within our Rails app. When we deploy, asset pre-compilation takes ~20 minutes.
Based on the deploy logs, it appears as though most of this time is spent pre-compiling a 3.3MB javascript file. That file "app.js" concatenates two files which are generated by webpack:
# app.js
//= require vendor-bundle (250KB)
//= require app-bundle (3.3MB)
Should we just come to expect long pre-compile times given the size of app-bundle? Or, can we improve things?
As an additional note, we tried directly compiling app-bundle, instead of requiring it through app.js, and it took the same amount of time.
UPDATE:
We ended up breaking out the client code into a separate create-react-app project, which connects to our Rails app via API. The complexity of our devops and deployment pipeline was greatly reduced -- short of really digging into this error.
webpack.vendor.config.js
andwebpack.app.config.js
files – Madalene