Sign in
Log inSign up
Wilbert Aristo

1.1K reads

2 comments

Kasia
Kasia
Oct 12, 2023

Hello Wilbert! Thank you so much for this article, it helped me greatly to move away from webpacker and have a config that I can follow! One question, whenever I import a static asset (an image) in React code in development I have a problem that it is searched for in Rails server public url not webpack dev server url. Would you use some util that checks proper url in manifest.json?

·
·1 reply
Wilbert Aristo
Wilbert Aristo
Author
·Oct 17, 2023

Hello Kasia! Apologies for the late reply. I'm super glad that the article helped you :)

Regarding your question, can I confirm that you did not store the static asset in the public folder? any reason for such arrangement? In my opinion, static files can just be stored directly in the public folder / called directly from CDN.

The only utils I created were just to load and read the content in manifest.json, the content in manifest.json is dictated by WebpackAssetsManifest plugin. I am honestly not too sure about loading static assets from dev server. Maybe you could explore the plugin's documentation to see if this is possible? Best of luck!

·