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
Applications using Sprockets, Rails UJS, but not CoffeeScript cannot consume Rails via git prior to Rails UJS abandoning CoffeeScript #46292
Comments
@rafaelfranca @skipkayhil, any ideas on how we could address this?
|
@sambostock sorry this didn't get any attention until now, and thanks for the detailed writeup. A few thoughts, please let me know if they make sense or are on the wrong track.
It sounds to me like this is going to be an issue on any existing stable branch or tag, not just
Is this also going to be an issue in |
Thanks for following up @ghiculescu!
Yep, this will apply to all of the previous stable branches as well.
This will not be an issue going forward as the compiled files are actually present in the repo now here.
Out of the three options:
|
I was thinking the same, + the workaround is just to add the |
@ghiculescu @skipkayhil How do ya'll feel about closing this one? I think that since 7.1 is released, and upgrading will fix it, the alternative being add
Which seems totally reasonable to me. |
Yes if it’s fixed in 7.1 we should close. |
I cannot reproduce the bug with current
|
Context
Our application continues to run into the bug fixed by #46110, as the fix is not present on any release. While discussing temporary monkey patches in Slack, @eileencodes recommended pointing our app to the
7-0-stable
branch of Rails, which contains an unreleased backport. When trying to switch over, we ran into the following error:This same error occurs even if switching from the 7.0.4 published release of the gem to directly to the corresponding
v7.0.4
git tag, indicating the issue is due to consuming Rails via git, as opposed to a commit introduced on7-0-stable
since the 7.0.4 release.Investigation
@bryanparadis and I conducted an investigation and came to the following conclusion:
Prior to #45546, Rails UJS was written as
.coffeescript
files.When a host app still using Sprockets for Javascript and including Rails UJS in its manifest compiles assets it tries to include those files. In the published versions of Rails, these files have been already compiled into regular Javascript, so no additional compilation is necessary.
If Rails is being consumed via git, the files only exist as
.coffeescript
files, so Sprockets tries to loadcoffee_script
to compile them.If the host application does not depend on
coffee_script
, then this raises aLoadError
.Steps to reproduce
Reproduction Script
Expected behavior
Consuming a released version of Rails or its equivalent git tag should behave the same.
Actual behavior
Applications that work with a released version of Rails (e.g. 7.0.4) do not work with the equivalent git tag (e.g.
v7.0.4
) under certain circumstances:coffee-script
System configuration
Rails version:
v7.0.4
Ruby version: 3.1.2
The text was updated successfully, but these errors were encountered: