usabilityhub / rails-erb-loader

Embedded Ruby (.erb) webpack loader for Ruby projects.
MIT License
103 stars 28 forks source link

use quotes to reference the runnerPath when spewing the command fixes #105 #106

Open jwoodrow opened 2 years ago

jwoodrow commented 2 years ago

Looks like the rails runner interprets anything starting with a / as a regex so when the runnerPath ends up being an absolute path it breaks.

fixes #105

PikachuEXE commented 2 years ago

Thanks for your PR! Is it possible to add a test case to ensure this won't be broken again?

texpert commented 2 months ago

Yes, on Yarn 4.x I've got this failure running a pet project with shakapacker-dev-server:

ERROR in ./app/javascript/src/js/pagy.js.erb
Module build failed (from ./.yarn/__virtual__/rails-erb-loader-virtual-55fc15ca4e/5/thunder/.yarn/berry/cache/rails-erb-loader-https-7752a0de6a-10c0.zip/node_modules/rails-erb-loader/index.js):
Error: rails-erb-loader failed with code: 1
    at ChildProcess.<anonymous> (/Users/Shared/dev/ruby/rails_6_rss_reader/.yarn/__virtual__/rails-erb-loader-virtual-55fc15ca4e/5/thunder/.yarn/berry/cache/rails-erb-loader-https-7752a0de6a-10c0.zip/node_modules/rails-erb-loader/index.js:129:16)
    at ChildProcess.emit (node:events:518:28)
    at maybeClose (node:internal/child_process:1105:16)
    at Socket.<anonymous> (node:internal/child_process:457:11)
    at Socket.emit (node:events:518:28)
    at Pipe.<anonymous> (node:net:337:12)
 @ ./app/javascript/packs/application.js 24:0-31

webpack 5.91.0 compiled with 1 error in 4223 ms

Using the 'moonproject:master' branch solved the issue.

I've took a glance at the tests, but have no idea how to test this. Weird is, testing this branch results in this, cited above, error on 9 tests. Everything's OK, though, when running the app (development mode).