excid3 / esbuild-rails

Esbuild Rails plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error on bin/dev

taylorbrooks opened this issue · comments

This is likely an error on my Rails setup versus esbuild-rails. I'm wondering if there is something obvious I missed in the implementation...

This is the stack trace I get when running bin/dev:

~/Code/simple-donation/simpledonation[esbuild]$ bin/dev
09:55:50 web.1  | started with pid 66906
09:55:50 css.1  | started with pid 66907
09:55:50 js.1   | started with pid 66908
09:55:50 web.1  | Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
09:55:50 css.1  | Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
09:55:50 js.1   | yarn run v1.22.19
09:55:50 js.1   | $ node esbuild.config.js --watch
09:55:50 js.1   | Done in 0.29s.
09:55:51 js.1   | exited with code 0
09:55:51 system | sending SIGTERM to all processes
09:55:51 css.1  | rails aborted!
09:55:51 css.1  | SignalException: SIGTERM
09:55:51 css.1  | <internal:dir>:128:in `[]'
09:55:51 css.1  | /Users/taylorbrooks/Code/simple-donation/simpledonation/config/application.rb:6:in `<main>'
09:55:51 css.1  | /Users/taylorbrooks/Code/simple-donation/simpledonation/Rakefile:6:in `<main>'
09:55:51 css.1  | /Users/taylorbrooks/Code/simple-donation/simpledonation/bin/rails:6:in `<top (required)>'
09:55:51 css.1  | <internal:/Users/taylorbrooks/.rbenv/versions/3.1.3/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
09:55:51 css.1  | <internal:/Users/taylorbrooks/.rbenv/versions/3.1.3/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
09:55:51 css.1  | /Users/taylorbrooks/Code/simple-donation/simpledonation/bin/spring:10:in `block in <top (required)>'
09:55:51 css.1  | <internal:kernel>:90:in `tap'
09:55:51 css.1  | /Users/taylorbrooks/Code/simple-donation/simpledonation/bin/spring:7:in `<top (required)>'
09:55:51 css.1  | bin/rails:2:in `load'
09:55:51 css.1  | bin/rails:2:in `<main>'
09:55:51 css.1  | (See full trace by running task with --trace)
09:55:51 css.1  | exited with code 1
09:55:51 web.1  | terminated by SIGTERM

My Procfile.dev looks like this:

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

If I drop-off the js process, bin/dev works as expected.

The build command looks like this: "build": "node esbuild.config.js"
And my esbuild config looks like this:

const path = require('path')
const rails = require('esbuild-rails')

require("esbuild").build({
  entryPoints: ["application.js"],
  bundle: true,
  outdir: path.join(process.cwd(), "app/assets/builds"),
  absWorkingDir: path.join(process.cwd(), "app/javascript"),
  plugins: [rails()],
}).catch(() => process.exit(1))

If I run yarn build from the CLI (not part of the bin/dev process) it works fine:

~/Code/simple-donation/simpledonation[esbuild]$ yarn build
yarn run v1.22.19
$ node esbuild.config.js
✨  Done in 0.20s.

Been banging my head against the wall for about an hour. Totally understand if you want to close as I don't expect this to be an issue with the package. Just wondering if there is anything obvious I'm missing.

Thanks for your work on this! I'm a huge beneficiary of your work in the Rails community and I'm a fan. :)

I should also say that when I change my build script to esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds --public-path=assets and re-run bin/dev, it works as expected.

(but I don't get the globbing functionality in grabbing all the Stimulus controllers and have to run that manifest command)

I'm going to close this. I decided to not use esbuild-rails for now and run the manifest:update task for now.

The error you posted is from the tailwindcss:watch command, not esbuild.