-
Notifications
You must be signed in to change notification settings - Fork 121
Update README to mention pin_all_from for local modules #95
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
Conversation
Added info about `pin_all_from` and note about migrating from sprockets to propshaft
@Rotario I find this info very useful. Are you able to finish the pull request? |
Co-authored-by: Nipun Paradkar <[email protected]>
Co-authored-by: Nipun Paradkar <[email protected]>
I've added the suggested changes |
``` | ||
Which imports the function from `app/javascript/src/example_function.js`. | ||
|
||
Note: Sprockets used to serve assets (albeit without filename digests) it couldn't find from the `app/javascripts` folder with logical relative paths, meaning pinning local files wasn't needed. Propshaft doesn't have this fallback, so when you use Propshaft you have to pin your local modules. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you may need to do this for production anyways. In development Sprockets will serve those plain assets (without the digest), but in production you'll likely see 404 for the same requests.
This could maybe be simplified to a warning to make sure that one pins all files one needs from app/javascript.
Whilst migrating from sprockets to propshaft, my relative imports stopped working due to the differences in asset fallbacks. Which I think Sprockets does and Propshaft doesn't.
The README doesn't yet mention pin_all_from which is really useful to know to get relative imports working from the import map.