Class: Webpacker::WebpackRunner

Inherits:
Runner
  • Object
show all
Defined in:
lib/webpacker/webpack_runner.rb

Instance Method Summary collapse

Methods inherited from Runner

#initialize, run

Constructor Details

This class inherits a constructor from Webpacker::Runner

Instance Method Details

#runObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/webpacker/webpack_runner.rb', line 6

def run
  env = Webpacker::Compiler.env

  cmd = if node_modules_bin_exist?
    ["#{@node_modules_bin_path}/webpack"]
  else
    ["yarn", "webpack"]
  end
  cmd += ["--config", @webpack_config] + @argv

  Dir.chdir(@app_path) do
    Kernel.exec env, *cmd
  end
end