Skip to content

Issues with esm.sh (and possibly other bundlers) #95

@DmitrySharabin

Description

@DmitrySharabin

Speaking of the color elements. There are two issues:

  1. Minification breaks NudeElement's logic: Minification performed by bundlers (e.g., esm.sh) breaks getSuperMethod() #94

Adding the ?dev query parameter to an element's script URL helps. It disables minification and preserves function names. However,

  1. CSS assets aren't served by esm.sh

The element styles are resolved at runtime relative to import.meta.url. esm.sh relocates JS into /es2022/, but doesn't serve CSS assets at those paths (or at the exports-mapped paths that we specified in package.json: ./*.css./src/*/*.css). All CSS requests return 404.

Our last commit in NudeElement that adds bundler compatibility to the styles plugin partially helps. getStyle() now handles bundler-friendly alternatives to relative URL resolution. However, CSS import attributes (the most reliable fix) lack Safari support, so a cross-browser solution is not there yet.

Unfortunately, even the upcoming change in the way we add shadow styles (static styles = new URL("./foo.css", import.meta.url)) won't work with esm.sh either. It's basically what it already does now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions