Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request adds support for Webpack into the web application and uses it to serve all third party dependencies. Additionally, all the application JS files have been rewritten to drop jQuery.
PR #50 added support for Yarn, added in Rails 5.1, and used it to fetch third party dependencies: Bootstrap, jQuery and Cookie Consent. However, those assets were still digested by Sprockets. This worked almost fine, but recently a regression was found: Sprockets did not digest the glyphicons used by the dashboard and the application rendered boxes instead.
This pull requests fixes that regression because Bootstrap, jQuery, Cookie Consent and Rails UJS are now being fetched by Yarn but they are precompiled using Webpack, added to the project through the webpacker gem. Sprockets is still being used to digest the application (first-party) JS and CSS sources.
During this process, it was found that jQuery was causing some concurrent dependency issues with the application sources (app/assets/javascripts/**/*.js) that used jQuery, because they were being parsed before jQuery was fully loaded, thus causing issues such as jQuery is not defined. Instead of looking for a solution to make the Sprockets assets waiting for the Webpack assets to be fully loaded, given that this web application has so little JS code at this moment, the decision was made to drop jQuery from the application sources. This means that app/assets/**/*.js are now vanilla JS files that uses native ES5 functions.