Skip to content
Dorian Marié edited this page Oct 12, 2021 · 3 revisions

Welcome to the jsbundling-rails wiki!

Different builds for production and development/test environments

e.g. how to have React production build on production and keep the development build on development/test environments

package.json

"scripts": {
  "build": "esbuild app/javascript/*.* --bundle --outdir=app/assets/builds '--define:process.env.NODE_ENV=\"production\"' --minify",
  "build-dev": "esbuild app/javascript/*.* --bundle --outdir=app/assets/builds"
}

Procfile.dev

web: bin/rails server -p 3000
js: yarn build-dev --watch

Credits to @betorina