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

Vite support #38

Closed
JonathonRP opened this issue May 7, 2024 · 4 comments
Closed

Vite support #38

JonathonRP opened this issue May 7, 2024 · 4 comments

Comments

@JonathonRP
Copy link

Is this supported in vite? Getting undefined Temporal and ect. Importing global.

@arshaw
Copy link
Member

arshaw commented May 8, 2024

@JonathonRP, do you have a "main" file that initializes the root component? The 'temporal-polyfill/global' import should go at the top of that file. I bet your error is occurring because the temporal import is occurring after some top-level code that uses it.

@JonathonRP
Copy link
Author

I'm using vite and sveltekit. My main top level is vite.config.ts and I tried importing from there global but that did not work and have been trying various other methods to populate vites define/vite.esbuild define also

@JonathonRP
Copy link
Author

also noticed it uses globalThis which does that work in node?
@arshaw

@arshaw
Copy link
Member

arshaw commented May 29, 2024

globalThis works since Node 12.

vite.config.ts is the wrong place to import the polyfill as its a config file and does not run within the browser.

@arshaw arshaw closed this as completed May 29, 2024
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

No branches or pull requests

2 participants