Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught Error: Module build failed from from ./node_modules/rails-erb-loader/index.js #258

SylarRuby opened this issue Jun 6, 2019 · 1 comment


None yet
2 participants
Copy link

commented Jun 6, 2019

"stimulus": "^1.1.1"
rails 6 rc1
webpack "^4.29.6"

Hi all. This would be my first to use Stimulus in a production environment. In development, all is well. When I ran both:

  • RAILS_ENV=production rake assets:precompile
  • NODE_ENV=production bundle exec rake webpacker:compile

My stimulus js controllers fail and points to, for example, line 2 (without the 👈🏼):

export default class extends Controller {
  static targets = [ "file", "image" ] 👈🏼

Inside config/webpack/loaders/erb.js

module.exports = {
  test: /\.erb$/,
  enforce: 'pre',
  exclude: /node_modules/,
  use: [{
    loader: 'rails-erb-loader',
    options: {
      runner: (/^win/.test(process.platform) ? 'ruby ' : '') + 'bin/rails runner'

A quick google search said something about comments in js file? My javascript/controllers only has one .js.erb file, others are .js

Do I need to run a special command for production? Thanks.


This comment has been minimized.

Copy link

commented Jun 6, 2019

You're probably missing the @babel/plugin-proposal-class-properties plugin (see If that's not it, feel free to repost this question in our community forum.

@javan javan closed this Jun 6, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.