This is a brand new rails app without any code. I am trying to test webpacker in production env. Following is the only code I have in packs/application.js:
import React from 'react';
import ReactDOM from 'react-dom';
ReactDOM.createElement(<div/>, document.getElementById('c'))
My Gemfile is also fairly simple:
source 'https://rubygems.org'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
gem 'rails', '~> 5.1.5'
gem 'sqlite3'
gem 'puma', '~> 3.7'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'webpacker'
gem 'coffee-rails', '~> 4.2'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.5'
group :development, :test do
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
gem 'capybara', '~> 2.13'
gem 'selenium-webdriver'
end
group :development do
gem 'web-console', '>= 3.3.0'
gem 'listen', '>= 3.0.5', '< 3.2'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
gem "capistrano", "~> 3.10", require: false
gem "capistrano-rails", "~> 1.3", require: false
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
When I deploy it fails with the following. I don't know why its trying to compile a test file "node-sass/test/fixtures".
I, [2018-09-13T13:41:35.041862 #20614] INFO -- : Writing /var/sg/releases/20180913080816/public/assets/node-sass/test/fixtures/cwd-include-path/expected-f84c472c50bde074489897e0eb2c3d732ebc7a54e9a103878ab966a3cfb5ce94.css.gz
I, [2018-09-13T13:41:35.048182 #20614] INFO -- : Writing /var/sg/releases/20180913080816/public/assets/node-sass/test/fixtures/cwd-include-path/outside-f84c472c50bde074489897e0eb2c3d732ebc7a54e9a103878ab966a3cfb5ce94.css
I, [2018-09-13T13:41:35.048322 #20614] INFO -- : Writing /var/sg/releases/20180913080816/public/assets/node-sass/test/fixtures/cwd-include-path/outside-f84c472c50bde074489897e0eb2c3d732ebc7a54e9a103878ab966a3cfb5ce94.css.gz
rake aborted!
Sass::SyntaxError: File to import not found or unreadable: outside.
Load paths:
/var/sg/releases/20180913080816/app/assets/config
/var/sg/releases/20180913080816/app/assets/images
/var/sg/releases/20180913080816/app/assets/javascripts
/var/sg/releases/20180913080816/app/assets/stylesheets
/var/sg/shared/bundle/ruby/2.5.0/gems/coffee-rails-4.2.2/lib/assets/javascripts
/var/sg/shared/bundle/ruby/2.5.0/gems/actioncable-5.1.6/lib/assets/compiled
/var/sg/shared/bundle/ruby/2.5.0/gems/actionview-5.1.6/lib/assets/compiled
/var/sg/shared/bundle/ruby/2.5.0/gems/turbolinks-source-5.2.0/lib/assets/javascripts
/var/sg/releases/20180913080816/node_modules
/var/sg/releases/20180913080816/node_modules/node-sass/test/fixtures/cwd-include-path/root/index.scss:1
/var/sg/shared/bundle/ruby/2.5.0/gems/sass-3.5.7/lib/sass/tree/import_node.rb:67:in `rescue in import'
/var/sg/shared/bundle/ruby/2.5.0/gems/sass-3.5.7/lib/sass/tree/import_node.rb:44:in `import'
/var/sg/shared/bundle/ruby/2.5.0/gems/sass-3.5.7/lib/sass/tree/import_node.rb:28:in `imported_file'
/var/sg/shared/bundle/ruby/2.5.0/gems/sass-3.5.7/lib/sass/tree/import_node.rb:37:in `css_import?'
/var/sg/shared/bundle/ruby/2.5.0/gems/sass-3.5.7/lib/sass/tree/visitors/perform.rb:310:in `visit_import'
/var/sg/shared/bundle/ruby/2.5.0/gems/sass-3.5.7/lib/sass/tree/visitors/base.rb:36:in `visit'
/var/sg/shared/bundle/ruby/2.5.0/gems/sass-3.5.7/lib/sass/tree/visitors/perform.rb:158:in `block in visit'
/var/sg/shared/bundle/ruby/2.5.0/gems/sass-3.5.7/lib/sass/stack.rb:79:in `block in with_base'
/var/sg/shared/bundle/ruby/2.5.0/gems/sass-3.5.7/lib/sass/stack.rb:135:in `with_frame'
/var/sg/shared/bundle/ruby/2.5.0/gems/sass-3.5.7/lib/sass/stack.rb:79:in `with_base'
/var/sg/shared/bundle/ruby/2.5.0/gems/sass-3.5.7/lib/sass/tree/visitors/perform.rb:158:in `visit'
/var/sg/shared/bundle/ruby/2.5.0/gems/sass-3.5.7/lib/sass/tree/visitors/base.rb:52:in `block in visit_children'
/var/sg/shared/bundle/ruby/2.5.0/gems/sass-3.5.7/lib/sass/tree/visitors/base.rb:52:in `map'
/var/sg/shared/bundle/ruby/2.5.0/gems/sass-3.5.7/lib/sass/tree/visitors/base.rb:52:in `visit_children'
/var/sg/shared/bundle/ruby/2.5.0/gems/sass-3.5.7/lib/sass/tree/visitors/perform.rb:167:in `block in visit_children'
/var/sg/shared/bundle/ruby/2.5.0/gems/sass-3.5.7/lib/sass/tree/visitors/perform.rb:179:in `with_environment'
/var/sg/shared/bundle/ruby/2.5.0/gems/sass-3.5.7/lib/sass/tree/visitors/perform.rb:166:in `visit_children'
/var/sg/shared/bundle/ruby/2.5.0/gems/sass-3.5.7/lib/sass/tree/visitors/base.rb:36:in `block in visit'
/var/sg/shared/bundle/ruby/2.5.0/gems/sass-3.5.7/lib/sass/tree/visitors/perform.rb:186:in `visit_root'
/var/sg/shared/bundle/ruby/2.5.0/gems/sass-3.5.7/lib/sass/tree/visitors/base.rb:36:in `visit'
/var/sg/shared/bundle/ruby/2.5.0/gems/sass-3.5.7/lib/sass/tree/visitors/perform.rb:157:in `visit'
/var/sg/shared/bundle/ruby/2.5.0/gems/sass-3.5.7/lib/sass/tree/visitors/perform.rb:10:in `visit'
/var/sg/shared/bundle/ruby/2.5.0/gems/sass-3.5.7/lib/sass/tree/root_node.rb:36:in `css_tree'
/var/sg/shared/bundle/ruby/2.5.0/gems/sass-3.5.7/lib/sass/tree/root_node.rb:20:in `render'
/var/sg/shared/bundle/ruby/2.5.0/gems/sass-3.5.7/lib/sass/engine.rb:290:in `render'
/var/sg/shared/bundle/ruby/2.5.0/gems/sass-rails-5.0.7/lib/sass/rails/template.rb:47:in `evaluate'
/var/sg/shared/bundle/ruby/2.5.0/gems/tilt-2.0.8/lib/tilt/template.rb:109:in `render'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/legacy_tilt_processor.rb:25:in `call'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:75:in `call_processor'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `call_processors'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:60:in `block in load'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:44:in `load'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:47:in `load'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/bundle.rb:23:in `block in call'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/utils.rb:200:in `dfs'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/bundle.rb:24:in `call'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:75:in `call_processor'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `call_processors'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:60:in `block in load'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:44:in `load'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:47:in `load'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/base.rb:66:in `find_asset'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/base.rb:73:in `find_all_linked_assets'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:142:in `block in find'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:228:in `block in stat_tree'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `each'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `stat_directory'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:227:in `stat_tree'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:231:in `block in stat_tree'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `each'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `stat_directory'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:227:in `stat_tree'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:231:in `block in stat_tree'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `each'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `stat_directory'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:227:in `stat_tree'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:231:in `block in stat_tree'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `each'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `stat_directory'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:227:in `stat_tree'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:231:in `block in stat_tree'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `each'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `stat_directory'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:227:in `stat_tree'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:231:in `block in stat_tree'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `each'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `stat_directory'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:227:in `stat_tree'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:105:in `each'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:105:in `block in logical_paths'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:104:in `each'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:104:in `logical_paths'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:140:in `find'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:186:in `compile'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:68:in `block (3 levels) in define'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/rake/sprocketstask.rb:147:in `with_logger'
/var/sg/shared/bundle/ruby/2.5.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:67:in `block (2 levels) in define'
/var/sg/shared/bundle/ruby/2.5.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
/home/subbu/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.4/lib/bundler/cli/exec.rb:74:in `load'
/home/subbu/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.4/lib/bundler/cli/exec.rb:74:in `kernel_load'
/home/subbu/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.4/lib/bundler/cli/exec.rb:28:in `run'
/home/subbu/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.4/lib/bundler/cli.rb:424:in `exec'
/home/subbu/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.4/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/home/subbu/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.4/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/home/subbu/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.4/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
/home/subbu/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.4/lib/bundler/cli.rb:27:in `dispatch'
/home/subbu/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.4/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
/home/subbu/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.4/lib/bundler/cli.rb:18:in `start'
/home/subbu/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.4/exe/bundle:30:in `block in <top (required)>'
/home/subbu/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.4/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
/home/subbu/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.4/exe/bundle:22:in `<top (required)>'
/home/subbu/.rvm/gems/ruby-2.5.1/bin/bundle:23:in `load'
/home/subbu/.rvm/gems/ruby-2.5.1/bin/bundle:23:in `<main>'
/home/subbu/.rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:24:in `eval'
/home/subbu/.rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:24:in `<main>'
Don't mean to be ignorant but are you sure that bundle and yarn are both being run?
Seems like the issue is coming from sprockets (not webpacker)
Could you post in your package.json or a sample app to better be able to debug?
I had this issue, and I think I resolved it by changing this setting in config/initializers/assets.rb:
# Add Yarn node_modules folder to the asset load path.
Rails.application.config.assets.paths << Rails.root.join('node_modules')
I just commented out the line, and I can precompile again. (Almost... actually, I could precompile again after doing yarn install)... I got this message first:
========================================
Your Yarn packages are out of date!
Please run `yarn install` to update.
========================================
So, I ran yarn install and then just went ahead and removed everything from my public/assets/* as a test, I had to yarn install again after that, before I could rake assets:precompile a second time.
I think what's happening here is, I have a relatively new application built on Rails 5.2 that was not installed with --webpack. And I've honestly never used webpack before, or yarn either for that matter. So I'm installing webpack the manual way, according to the webpacker gem instructions, to get access to stimulus and other things obviously... the app is mostly new, maybe 10 weeks of development already, but we had definitely added some javascript in the asset pipeline in the older way. (sprockets?)
Well I've learned the basic ES6 module revealing structure and I think we're outgrowing asset pipeline, so wanted to install webpack.
I was not ready to convert all of my JS into modules and divide it into packs. I am really new at this webpack business. But I had a similar issue earlier trying to install foundation-rails without causing yarn to trip over it; I wound up actually just needing to tweak the assets.rb with some assets.rb "BLACK_MAGIC" that I found by googling, it felt very hackish at the time but allowed me to move on.
Long story short, I am pretty sure (at least I think) that normally, you don't usually use the ruby asset pipeline to compile javascripts at all, at least in a modern app if you're doing webpacker.
Included below is my whole assets.rb with the section I removed to make this error go away; that line is shown here as super commented out:
# Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0'
# Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.images_path
# Add Yarn node_modules folder to the asset load path.
#### Rails.application.config.assets.paths << Rails.root.join('node_modules')
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in the app/assets
# folder are already added.
# Rails.application.config.assets.precompile += %w( admin.js admin.css )
#
# The below works, except that Foundation has a lot of partials that can't be
# compiled as stand-alone by asset precompiler
# Rails.application.config.assets.precompile += %w( *.js *.css *.svg )
Rails.application.config.assets.precompile << Proc.new { |path|
blacklist = [
# mention each asset to exclude specifically as a regex, eg:
# /nvd3\/src\/intro.js$/,
# /nvd3\/src\/outro.js$/,
# /^.*\.less$/,
# /admin\/modules/,
# /admin\/themes/,
# /admin\/responsive\..*css/
]
# full_path = Rails.application.assets.resolve(path)
# puts "path: #{path}\nfull_path: #{full_path}" if BLACK_MAGIC[:assets][:debug]
if (path =~ /(^[^_\/]|\/[^_])[^\/]*$/) and (path !~ Regexp.union(blacklist) )
# puts "including asset: " + full_path if BLACK_MAGIC[:assets][:debug]
true
else
# puts "excluding asset: " + full_path if BLACK_MAGIC[:assets][:debug]
false
end
}
I think with this one small change, everything is working as expected now, and I can gradually phase out use of the asset pipeline for javascript. (If I'm still doing it wrong, or if anyone please has a link to a good favorite article on this subject, please share that to help us to understand this better!)
@kingdonb tks for help, it's working as expected
Most helpful comment
I had this issue, and I think I resolved it by changing this setting in
config/initializers/assets.rb:I just commented out the line, and I can precompile again. (Almost... actually, I could precompile again after doing
yarn install)... I got this message first:So, I ran
yarn installand then just went ahead and removed everything from my public/assets/* as a test, I had toyarn installagain after that, before I couldrake assets:precompilea second time.I think what's happening here is, I have a relatively new application built on Rails 5.2 that was not installed with
--webpack. And I've honestly never used webpack before, or yarn either for that matter. So I'm installing webpack the manual way, according to the webpacker gem instructions, to get access to stimulus and other things obviously... the app is mostly new, maybe 10 weeks of development already, but we had definitely added some javascript in the asset pipeline in the older way. (sprockets?)Well I've learned the basic ES6 module revealing structure and I think we're outgrowing asset pipeline, so wanted to install webpack.
I was not ready to convert all of my JS into modules and divide it into packs. I am really new at this webpack business. But I had a similar issue earlier trying to install foundation-rails without causing yarn to trip over it; I wound up actually just needing to tweak the assets.rb with some assets.rb "BLACK_MAGIC" that I found by googling, it felt very hackish at the time but allowed me to move on.
Long story short, I am pretty sure (at least I think) that normally, you don't usually use the ruby asset pipeline to compile javascripts at all, at least in a modern app if you're doing webpacker.
Included below is my whole
assets.rbwith the section I removed to make this error go away; that line is shown here as super commented out:I think with this one small change, everything is working as expected now, and I can gradually phase out use of the asset pipeline for javascript. (If I'm still doing it wrong, or if anyone please has a link to a good favorite article on this subject, please share that to help us to understand this better!)