lib/sewing_kit/webpack/compiler.rb in sewing_kit-0.114.2 vs lib/sewing_kit/webpack/compiler.rb in sewing_kit-0.122.0
- old
+ new
@@ -20,11 +20,11 @@
def compile
raise NodeNotInstalled unless node_installed?
raise NodeSewingKitNotRunnable, node_env unless File.exist?('node_modules/.bin/sewing-kit')
result = Kernel.system(
- { 'NODE_ENV' => node_env },
+ environment,
*command,
chdir: Rails.root.to_s,
out: $stdout,
err: $stderr
)
@@ -43,9 +43,21 @@
'node_modules/.bin/sewing-kit',
'build',
'--mode',
node_env,
].concat(options).reject(&:empty?)
+ end
+
+ def environment
+ environment = {
+ 'NODE_ENV' => node_env,
+ }
+
+ if defined?(ShopifyCloud)
+ environment['SK_ASSET_DIR'] = ShopifyCloud::AssetUploader.asset_directory
+ end
+
+ environment
end
def node_env
ENV['NODE_ENV'] || Rails.env.to_s
end