Skip to content

Allow user-configurable asset imports for better bundler compatibility #27

Description

@nyan-left

Hi, nice to see this polished!

I was following https://dgreenheck.github.io/tree-js/ when you initially released it :)

There's a small compatibility issue that could be resolved.
The current method of importing assets directly in the library doesn't work with all bundlers:

import birchAo from './assets/bark/birch_ao_1k.jpg';

Some bundlers prefer different syntax (e.g., new URL syntax) or have specific asset handling requirements.

Consider allowing users to import and pass assets themselves, rather than hardcoding imports within the library - This would improve compatibility across different build environments and give users more control over asset management.

Alternatively, using data URLs for the images could be a solution that would be supported by any bundler.

Happy to contribute with a PR if needed!

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