rails / jsbundling-rails

Bundle and transpile JavaScript in Rails with esbuild, rollup.js, or Webpack.
MIT License
831 stars 143 forks source link

Namespace helper methods for javascript:build tasks #172

Closed excid3 closed 1 year ago

excid3 commented 1 year ago

Methods defined in Rake files are added to the global namespace. This means cssbundling-rails and jsbundling-rails using the same build_command method name get overridden by one or the other.

This introduces a module to namespace these methods and provides a place for any future methods to be defined.

Since these only apply to the tasks in build.rake, I just defined the module there, but we could extract it to a file and require it instead.

See also https://github.com/rails/cssbundling-rails/pull/132 https://github.com/rails/cssbundling-rails/issues/131

cc @terracatta

terracatta commented 1 year ago

Thanks @excid3 TIL that methods defined here are in a shared namespace with all other rake tasks. I've updated my open PRs as well. https://github.com/hotwired/turbo-rails/pull/494 and https://github.com/hotwired/stimulus-rails/pull/125.

cc/ @dhh & @rafaelfranca.

rafaelfranca commented 1 year ago

I wish those libraries were just one. They keep influencing each other. Maybe one day...