Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ssr): make import.meta.url be the filesystem URL #5268

Merged
merged 1 commit into from
Oct 12, 2021

Conversation

matthewp
Copy link
Contributor

Description

This makes import.meta.url be the file URL, the same as in Node ESM, Deno, Webpack, etc.

Additional context

This is a spinoff from #5252


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the Commit Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@patak-dev
Copy link
Member

See #5252 (comment) for reference, from @matthewp:

I deployed a test project in Cloudflare and import.meta.url is undefined. If you use their webpack template then it's the local filesystem URL as expected (because webpack is building to commonjs).

If it is undefined, it may be that they haven't yet implemented support in webworkers. We should keep an eye on this, as we may need to update the handling depending on ssr.target later.

@patak-dev patak-dev assigned antfu and unassigned antfu Oct 12, 2021
@patak-dev patak-dev requested a review from antfu October 12, 2021 15:23
@patak-dev patak-dev merged commit 7674cf2 into vitejs:main Oct 12, 2021
@matthewp matthewp deleted the import-meta-url branch October 12, 2021 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants