Method: Webpacker::WebpackRunner#run

Defined in:
lib/webpacker/webpack_runner.rb

#runObject



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

def run
  env = Webpacker::Compiler.env
  env["WEBPACKER_CONFIG"] = @webpacker_config

  cmd = if node_modules_bin_exist?
    ["#{@node_modules_bin_path}/webpack"]
  else
    ["yarn", "webpack"]
  end

  if @argv.include?("--debug-webpacker")
    cmd = [ "node", "--inspect-brk"] + cmd
  end

  cmd += ["--config", @webpack_config] + @argv

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