Skip to content

Having issues using rails-erb-loader with yarn 2 #105

@jwoodrow

Description

@jwoodrow

Hi,

I'm trying to migrate an existing project from yarn to yarn 2 (with pnp) but I'm encountering a strange issue when it comes to rails-erb-loader and webpack/webpacker

I'm using rails-erb-loader for a single file in webpacker which is i18njs translations (and a few extras) basically

But when I run bin/webpack-dev-server locally, after migrating to yarn 2 and dealing with the issues that pnp would raise, I get an error when trying to compile my i18njs/index.erb file which makes me think there's an issue with the way the runner is executed.

Please specify a valid ruby command or the path of a script to run.
Run 'rails runner -h' for help.

/Users/jwoodrow/.rvm/gems/ruby-3.0.1/gems/railties-6.1.4.1/lib/rails/commands/runner/runner_command.rb:45: unknown regexp options - jwdrw
/Users/jwoodrow/Work/project/.yarn/__vi...
      ^~~~~~~~~
/Users/jwoodrow/.rvm/gems/ruby-3.0.1/gems/railties-6.1.4.1/lib/rails/commands/runner/runner_command.rb:45: syntax error, unexpected '.'
...rs/jwoodrow/Work/project/.yarn/__virtual__/rails-erb-lo...
...                              ^
/Users/jwoodrow/.rvm/gems/ruby-3.0.1/gems/railties-6.1.4.1/lib/rails/commands/runner/runner_command.rb:45: syntax error, unexpected local variable or method, expecting end-of-input
...s-erb-loader-virtual-84e156f2b7/0/cache/rails-erb-loader-npm...

Is there something I'm not understanding here ? Everything works fine as long as I'm not using pnp by the way

The loader config is this one

{
  test: /\.erb$/,
  enforce: 'pre',
  exclude: /node_modules/,
  use: [{
    loader: 'rails-erb-loader',
    options: {
      runner: 'bundle exec rails runner'
    }
  }]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions