Closed cdauth closed 9 months ago
Closed as this has no reproduction, it's not really clear if this is an issue with this plugin specifically or with vite in general, and it appears you have a workaround.
I'm also not sure why you would bother doing an async import here -- wouldn't the markdown file be part of the bundle, and thus there would be no IO to await?
I have a file where I'm using a top-level
(await import('./x.md')).html
statement. This gets transpiled into(await __vitePreload(() => Promise.resolve().then(() => x), true ? void 0 : void 0)).html
. However,x
is defined further down in the code, leading to an errorUncaught ReferenceError: Cannot access 'x' before initialization
.As a workaround, I managed to solve the issue by using regular imports.