Rails 5.1 webpacker "import" the .js.erb file?
From app/javascript/packs/application.js
I'm trying import "../foo"
where the file is foo.js.erb
. Webpacker and yarn are great for other imports in application.js like import "../bar"
when this file bar.js
, but if I try with the file .js.erb
I get this error from webpack-dev-server:
ERROR in ./app/javascript/packs/application.js
Module not found: Error: Can't resolve '../foo' in '/Users/blah/backlot/projects/test/app/javascript/packs'
@ ./app/javascript/packs/application.js 3:0-27
@ multi (webpack)-dev-server/client?http://localhost:8080 ./app/javascript/packs/application.js
I have rails-erb-loader installed and if I look at the webpacker config then the erb loader is evaluated and looks at me, although I haven't touched any of them other than running rails webpacker:install
to create that config.
source to share