lib/webpack_rails/task.rb in webpack_rails-0.1.0 vs lib/webpack_rails/task.rb in webpack_rails-0.2.0
- old
+ new
@@ -45,17 +45,29 @@
end
ENV['NODE_PATH'] = prev_node_path
return_value
end
+ def build_result
+ begin
+ JSON.parse(File.open(File.join(working_dir, 'webpack-build-result.json')).read)
+ rescue Errno::ENOENT => e
+ {modules: []}
+ end
+ end
+
def run_webpack(opts = nil)
result = nil
+ if ENV['DISABLE_WEBPACK']
+ return build_result
+ end
task_duration = Benchmark.realtime do
result = with_app_node_path do
begin
task = self.new
task.run(opts)
+ build_result
rescue NodeTask::Error => e
raise self::Error.new(e)
end
end
end