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: account for jsx imports in config bundling #16653

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jxom
Copy link

@jxom jxom commented May 11, 2024

Description

Seems that when importing JSX files in vite.config.{js.ts}, the injection of file scope variables do not work. This PR fixes that.

Example

// foo.tsx
console.log(import.meta.url)
//          ^? ReferenceError: __vite_injected_original_import_meta_url is not defined
// vite.config.ts
import './foo'

Copy link

stackblitz bot commented May 11, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@cpojer
Copy link
Contributor

cpojer commented May 11, 2024

Thanks for fixing this!

@bluwy
Copy link
Member

bluwy commented May 11, 2024

Hmm we don't really explicitly support JSX in config files and I don't think we should fix any edge case related to it. Otherwise it'll be hard to move to another tool that loads JS or TS for Vite (since Vite's config loading is known to be problematic in some case too)

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.

None yet

3 participants