1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
module Webpacker
class Runner
def self.run(argv)
$stdout.sync = true
new(argv).run
end
def initialize(argv)
@argv = argv
@app_path = File.expand_path(".", Dir.pwd)
@node_modules_bin_path = ENV["WEBPACKER_NODE_MODULES_BIN_PATH"] || `yarnpkg bin`.chomp
@webpack_config = File.join(@app_path, "config/webpack/#{ENV["NODE_ENV"]}.js")
@webpacker_config = File.join(@app_path, "config/webpacker.yml")
unless File.exist?(@webpack_config)
$stderr.puts "webpack config #{@webpack_config} not found, please run 'bundle exec rails webpacker:install' to install Webpacker with default configs or add the missing config file for your custom environment."
exit!
end
end
end
end
|