class ViteRuby::MissingEntrypointError
a more specific error message depending on the situation.
NOTE: The complexity here is justified by the improved usability of providing
Internal: Raised when an entry is not found in the build manifest.
def initialize(info)
def initialize(info) @info = info super <<~MSG Vite Ruby can't find #{ file_name } in #{ config.manifest_path.relative_path_from(config.root) } or #{ config.assets_manifest_path.relative_path_from(config.root) }. Possible causes: #{ possible_causes(last_build) } :troubleshooting: #{ "\nContent in your manifests:\n#{ JSON.pretty_generate(manifest) }\n" if last_build.success } #{ "Last build in #{ config.mode } mode:\n#{ last_build.to_json }\n" if last_build.success } MSG end
def possible_causes(last_build)
def possible_causes(last_build) if last_build.success == false FAILED_BUILD_CAUSES .sub(':mode:', config.mode) .sub(':errors:', last_build.errors.to_s.gsub(/^(?!$)/, ' ')) elsif config.auto_build DEFAULT_CAUSES else DEFAULT_CAUSES + NO_AUTO_BUILD_CAUSES end end