lib/sewing_kit/webpack/compiler.rb in sewing_kit-0.29.2 vs lib/sewing_kit/webpack/compiler.rb in sewing_kit-0.30.0
- old
+ new
@@ -1,7 +1,8 @@
# frozen_string_literal: true
require 'sewing_kit/webpack/webpack'
+require 'sewing_kit/configuration'
module SewingKit
module Webpack
class Compiler
class NodeNotInstalled < StandardError
@@ -42,14 +43,21 @@
[
'node_modules/.bin/sewing-kit',
'build',
'--mode',
node_env,
- ].reject(&:empty?)
+ ].concat(options).reject(&:empty?)
end
def node_env
ENV['NODE_ENV'] || Rails.env.to_s
+ end
+
+ def options
+ build_options = SewingKit.configuration.build_options
+ return [] unless build_options
+
+ build_options.map { |key, value| ["--#{key}", value] }.flatten
end
def node_installed?
Kernel.system('node --version')
end