Stimulus Discourse

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

Hi all! It’s my first ever Rails 6 app in production :boom:Though I have an issue with Stimulus. Based on my issues here, Im still getting that an error:

Uncaught Error: Module build failed (from ./node_modules/rails-erb-loader/index.js):
Error: rails-erb-loader failed with code: 1

My .babelrc looks like this:

{
  "presets": [
    ["@babel/preset-env", {
      "modules": false,
      "targets": {
        "browsers": "> 1%",
        "uglify": true
      },
      "useBuiltIns": "entry"
    }]
  ],

  "plugins": [
    "@babel/syntax-dynamic-import",
    "@babel/plugin-proposal-class-properties"
  ]
}

My package.json:

{
  "name": "zired",
  "private": true,
  "dependencies": {
    "@rails/actiontext": "^6.0.0-alpha",
    "@rails/webpacker": "^4.0.2",
    "activestorage": "^5.2.3",
    "axios": "^0.18.0",
    "jquery": "^3.3.1",
    "qs": "^6.7.0",
    "rails-erb-loader": "^5.5.2",
    "stimulus": "^1.1.1",
    "stripe": "6.31.2",
    "sweetalert2": "^7.12.12",
    "toastr": "^2.1.4",
    "trix": "^1.1.1",
    "@babel/plugin-proposal-class-properties": "^7.4.4",
    "@babel/plugin-syntax-dynamic-import": "^7.2.0",
    "@babel/preset-env": "^7.4.5"
  },
  "devDependencies": {
    "webpack-dev-server": "3.3.1"
  }
}

in your Github issue you mention .js.erb being in javascript/controllers
.js.erb belongs to views. You should only have pure js files in this directory