Sha256: 4e4b2cc6c12a3bb4a6173930c4c3b2f382ccf55910f1bfcf31d88192e11a2226

Contents?: true

Size: 894 Bytes

Versions: 10

Compression:

Stored size: 894 Bytes

Contents

require "shellwords"
require "webpacker/runner"

module Webpacker
  class WebpackRunner < Webpacker::Runner
    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
        @argv.delete "--debug-webpacker"
      end

      if @argv.include?("--trace-deprecation")
        cmd = [ "node", "--trace-deprecation"] + cmd
        @argv.delete "--trace-deprecation"
      end

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

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

    private
      def node_modules_bin_exist?
        File.exist?("#{@node_modules_bin_path}/webpack")
      end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
webpacker-6.0.0.rc.5 lib/webpacker/webpack_runner.rb
webpacker-6.0.0.rc.4 lib/webpacker/webpack_runner.rb
webpacker-6.0.0.rc.3 lib/webpacker/webpack_runner.rb
webpacker-6.0.0.rc.2 lib/webpacker/webpack_runner.rb
webpacker-6.0.0.rc.1 lib/webpacker/webpack_runner.rb
webpacker-6.0.0.beta.7 lib/webpacker/webpack_runner.rb
webpacker-6.0.0.beta.6 lib/webpacker/webpack_runner.rb
webpacker-6.0.0.beta.5 lib/webpacker/webpack_runner.rb
webpacker-6.0.0.beta.4 lib/webpacker/webpack_runner.rb
webpacker-6.0.0.beta.3 lib/webpacker/webpack_runner.rb