Skip to content

FileAttachment metadata is missing, and missing files aren’t checked statically #27

@mbostock

Description

@mbostock

We don’t currently do any static analysis of file attachments, and so FileAttachment calls are missing metadata (such as the MIME type and last-modified time), and FileAttachment calls that reference files that don’t exist don’t throw statically (but will still throw when you try to load the associated data).

You do get a warning when building:

new URL("./does-not-exist.txt", import.meta.url) doesn't exist at build time, it will remain unchanged to be resolved at runtime. If this is intended, you can use the /* @vite-ignore */ comment to suppress this warning.

Ideally these would be errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions