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

Eject webpacker for jsbundling-rails #127

Merged
merged 1 commit into from
Aug 25, 2024

Conversation

joshwlewis
Copy link
Member

@joshwlewis joshwlewis commented Aug 20, 2024

Rails has retired the webpacker gem and it's general strategy: https://github.com/rails/webpacker. This project made fairly heavy use of webpacker given it was used to compile typescript, react components, JS dependencies, and more.

Continuing to use webpacker is not an option, as it blocks upgrades of many other things, including Node.js, the runtime openssl version, and numerous webpack plugins.

The options to replace webpacker are:

  • jsbundling-rails: This is a lightweight gem that basically adds yarn build into the rake assets:precompile task. This means most of the asset pipeline is compiled with node tooling (in our case: webpack).
  • shakapacker: This is the spiritual successor to webpacker. It's bigger, more robust, has more features. We weren't using most of the headline features (code splitting, hot module reloading) anyway, so I thought this might be overkill.
  • import maps + Hotwire: This is the strategy for Rails 7+. It's targeted more at the Rails app with sprinkled in JS. This isn't appropriate for this app, since nearly all our html is generated by React.

For the most part, the changes here are the result of the process outlined here: https://github.com/rails/jsbundling-rails/blob/main/docs/switch_from_webpacker.md.

I've deployed this to staging and it works as expected.

@joshwlewis joshwlewis had a problem deploying to cnb-registry-api-staging August 21, 2024 14:34 Failure
@joshwlewis joshwlewis temporarily deployed to cnb-registry-api-staging August 21, 2024 14:36 Inactive
@joshwlewis joshwlewis temporarily deployed to cnb-registry-api-staging August 21, 2024 18:20 Inactive
@joshwlewis joshwlewis marked this pull request as draft August 21, 2024 19:46
@joshwlewis joshwlewis temporarily deployed to cnb-registry-api-staging August 21, 2024 20:24 Inactive
Signed-off-by: Josh W Lewis <[email protected]>

Update Gemfile.lock

Signed-off-by: Josh W Lewis <[email protected]>

Additional adjustments to asset pipeline

Use inline image assets, drop sass-rails

Signed-off-by: Josh W Lewis <[email protected]>
@joshwlewis joshwlewis marked this pull request as ready for review August 21, 2024 20:49
@jkutner jkutner merged commit 30bfc2b into buildpacks:main Aug 25, 2024
2 checks passed
@joshwlewis joshwlewis deleted the webpacker-eject branch August 29, 2024 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants