Module: Kidspire::ViteManifest

Defined in:
lib/kidspire/vite_manifest.rb

Constant Summary collapse

MANIFEST_PATH =
-> { Rails.root.join("public/vite/.vite/manifest.json") }

Class Method Summary collapse

Class Method Details

.entry(name = "app/javascript/application.tsx") ⇒ Object



5
6
7
# File 'lib/kidspire/vite_manifest.rb', line 5

def self.entry(name = "app/javascript/application.tsx")
  manifest[name]
end

.manifestObject



9
10
11
12
13
14
15
16
17
18
# File 'lib/kidspire/vite_manifest.rb', line 9

def self.manifest
  if Rails.env.development?
    {}
  else
    @manifest ||= JSON.parse(File.read(MANIFEST_PATH.call))
  end
rescue Errno::ENOENT
  Rails.logger.warn "[Kidspire] Vite manifest not found at #{MANIFEST_PATH.call}. Run: bun run build"
  {}
end