Module: Webpacker::Compiler

Extended by:
Compiler
Included in:
Compiler
Defined in:
lib/webpacker/compiler.rb

Instance Method Summary collapse

Instance Method Details

#compileObject



14
15
16
17
18
19
# File 'lib/webpacker/compiler.rb', line 14

def compile
  return unless compile?
  cache_source_timestamp
  compile_task.invoke
  compile_task.reenable
end

#compile?Boolean



21
22
23
24
25
26
# File 'lib/webpacker/compiler.rb', line 21

def compile?
  return true unless File.exist?(cached_timestamp_path)
  return true unless File.exist?(Webpacker::Configuration.output_path)

  File.read(cached_timestamp_path) != current_source_timestamp
end

#default_watched_pathsObject



28
29
30
# File 'lib/webpacker/compiler.rb', line 28

def default_watched_paths
  ["#{Webpacker::Configuration.source}/**/*", "yarn.lock", "package.json", "config/webpack/**/*"].freeze
end