Skip to content

Compiler error when referencing import.meta.url in svelte scripts #4379

@jacobdeichert

Description

@jacobdeichert

Describe the bug

When trying to reference import.meta.url in a svelte script, a compiler error is thrown.

import.meta.url allows es modules to figure out what their filename/url is.

Logs

Screen Shot 2020-02-05 at 8 31 06 PM

To Reproduce

Copy/paste this into the REPL and view the console log error.

<script>
    console.log(import.meta.url);
</script>

Expected behavior

Compilation should leave import.meta.* alone :)

Severity

This is blocking a proof of concept i'm developing for a svelte static site generator that eliminates static trees and only hydrates trees marked as dynamic (partial hydration).

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