-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Revert "Use Railtie instead of Engine" #985
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
|
How about fixing the loading of the rake task? |
|
Strangely gem "webpacker", git: "https://github.com/rails/webpacker.git"but cloning webpacker to a local folder and pointing to it in Gemfile works as expected and gem "webpacker", path: "~/src/webpacker"Moving Webpacker to an Engine makes the first work, I'll continue researching a bit more. |
|
Found something, adding explicitly to This doesn't work: gem "webpacker", git: "https://github.com/rails/webpacker.git"
gem "sprockets-rails"This work: gem "sprockets-rails"
gem "webpacker", git: "https://github.com/rails/webpacker.git"And again changing Webpacker to an Engine makes this work regardless of the order. This work: gem "webpacker", git: "https://github.com/rails/webpacker.git", branch: "revert-to-engine"
gem "sprockets-rails" |
|
Note that in all cases the Webpacker rake tasks are correctly loaded is just enhancing that doesn't work because Rake::Task.task_defined?("assets:precompile") returns false in the failing cases. |
|
As a matter of principle it does feel slightly more correct for this to be a Railtie instead of an Engine. I don't feel strongly about that, but do worry about whether this Railtie-vs-Engine difference is by design, or is just luck that it ends up running at a 'better' time. However we decide to fix it, it sounds like we need a test to prove that the task gets enhanced regardless of the load order. |
|
The difference between an engine and railtie regardless the load order is: The railtie executes the rake_tasks blocks in order of definition. I don't think it is by design. It looks like an implementation detail. I also thing an Railtie is more correct, but I don't have strong opinion either. |
|
@guilleiguaran Guess we fixed this with |
|
@gauravtiwari I'm going to test this again and report results here |
|
Sure 👍 thanks |
|
@guilleiguaran Were you able to test this one? Thinking to make a new release this weekend. |
|
I can reproduce this as described in #985 (comment) and it still being fixed immediately switching to I'll merge this for now to unblock the release and check if we can do something else about the loading order issue. |
assets:precompile task is not being enhanced and therefore not executing
webpacker:compile when referencing webpacker master branch on Gemfile,
reverting back to Engine fix the problem immediately.
This reverts commit 6586ef7 and 2c0c7dc.