-
Notifications
You must be signed in to change notification settings - Fork 34
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
ReferenceError: __WC_CONFIG__
is not defined
#290
Comments
Could this be a bug with Astro? I wonder if we also see this issue with an older version of Astro. I'm wondering because this is literally the first thing we set in the vite config and I don't think this has ever really changed: tutorialkit/packages/astro/src/index.ts Lines 77 to 94 in 3e7e6cb
(also if that helps bisecting the combo that breaks, I've never encountered that issue when I was doing demos back in June) |
This issue isn't present on |
This is likely introduced in #219. When import of
There's two depedency chains for the
The first one works fine. But the second on comes from |
Something weird going on there. Tested this in minimal Astro reproduction: import { defineConfig } from "astro/config";
export default defineConfig({
vite: {
define: {
__MY_DEFINE__: '"Value set in config"',
},
},
}); ---
const frontmatter = __MY_DEFINE__;
---
<h1>My Component</h1>
<script define:vars={{frontmatter}}>
console.log({frontmatter, scriptScope: globalThis.__MY_DEFINE__})
setTimeout(() => {
console.log({frontmatter, scriptScope: globalThis.__MY_DEFINE__})
}, 1000)
</script> Looks like Vite's dev-time I'll try to find quick solution for us here so that we can release fix as soon as possible. Maybe convert the component into React one. 🤔 |
Oh good find! Thanks for digging in 🤩 |
Describe the bug
Freshly created tutorials without any modifications are running into
__WC_CONFIG__ is not defined
errors. This is coming up randomly and looks like possible race condition. When page is refreshed with cache clearing the error disappears, but normal refreshes run into this error immediatelly.This only affects dev mode.
Link to a StackBlitz project which shows the error
No response
Steps to reproduce
pnpm create tutorial
Expected behavior
Error should not happen.
Screenshots
Platform
Additional context
No response
The text was updated successfully, but these errors were encountered: