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

Webpacker migration asset_pack_path in jsbundling-rails #165

Open
7Ds7 opened this issue Aug 4, 2023 · 1 comment
Open

Webpacker migration asset_pack_path in jsbundling-rails #165

7Ds7 opened this issue Aug 4, 2023 · 1 comment

Comments

@7Ds7
Copy link

7Ds7 commented Aug 4, 2023

Upon migrating away from Webpacker to jsbundling-rails i am having difficulties finding one alternative way to webpacker asset_pack_path on jsbundling-rails.

The app in question relies heavily on asset_pack_path mainly for images that are shared in both frontend and rails views.
 asset_pack_path would resolve the path including the file hash but i do not find any alternative in the migration guide

With webpacker both the images imported in js/css files would resolve to the proper path and hash, and within the rails views  asset_pack_path would resolve to the same path/hash.

Am i missing something? is there one direct alternative for this helper?

@benkoshy
Copy link
Contributor

benkoshy commented Oct 30, 2024

If you are using jsbundling-rails with esbuild rather than webpack consider the following:

https://github.com/rails/jsbundling-rails?tab=readme-ov-file#how-can-i-reference-static-assets-in-javascript-code

Am pretty sure they would be a way of doing something similar with webpack. The general principles in the above link should be able to help you

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

No branches or pull requests

2 participants