Skip to content

Use import.meta.url in EXPORT_ES6 mode #7137

Closed

Description

@curiousdannii

Follow on to #5368. When in EXPORT_ES6 mode import.meta.url should be used. In browsers document.currentScript will probably still work, but __dirname will not work in Node. import.meta.url is supported in both, and it's cleaner and safer.

Activity

  1. saschanaz commented on Sep 17, 2018

    @saschanaz
    Collaborator

    https://aremodulesready.com/ The availability for import.meta.url seems fairly limited yet 😢

  2. curiousdannii commented on Sep 17, 2018

    @curiousdannii
    ContributorAuthor

    It was just added in Firefox 62. Edge support is still lacking. Detecting its support could be tricky? I'm not sure if it will throw a syntax error in browsers which don't support it.

    At the very least it's needed for Node, and supported in Node. Maybe leave browsers till later when it's reached stage 4.

  3. saschanaz commented on Sep 17, 2018

    @saschanaz
    Collaborator

    It's tricky because import.meta has a special syntactic form with a keyword so unsupported browsers will throw an early SyntaxError. Waiting Stage 4 makes sense, though.

  4. stale commented on Sep 18, 2019

    @stale

    This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 7 days. Feel free to re-open at any time if this issue is still relevant.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions