Skip to content

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

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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