-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Simplify installation of build dependencies by using package man…
…ager flags
- Loading branch information
Showing
3 changed files
with
6 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,4 @@ | ||
# frozen_string_literal: true | ||
|
||
# Set NODE_ENV before installation, so that Rails installs JS build dependencies | ||
# on servers that precompile assets. | ||
installation_tasks = ['yarn:install', 'webpacker:yarn_install'].select { |name| Rake::Task.task_defined?(name) }.each do |name| | ||
Rake::Task[name].enhance([:'vite_rails:set_node_env']) | ||
end | ||
|
||
# Ensure dependencies are installed in older versions of Rails | ||
Rake::Task['assets:precompile']&.enhance([:'vite:install_dependencies']) if installation_tasks.none? | ||
|
||
require 'vite_ruby' | ||
ViteRuby.install_tasks | ||
|
||
namespace :vite_rails do | ||
desc 'Fixes Rails management of node dev dependencies (build dependencies)' | ||
task :set_node_env do | ||
ENV['NODE_ENV'] = 'development' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters