mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-26 21:18:47 +02:00
fix(mdx-loader): fix cross-compiler cache randomly loading mdx with client/server envs (#10553)
This commit is contained in:
parent
05f3c203a2
commit
9e473bd080
4 changed files with 86 additions and 18 deletions
|
@ -132,3 +132,20 @@ export async function compileToJSX({
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO Docusaurus v4, remove temporary polyfill when upgrading to Node 22+
|
||||
export interface PromiseWithResolvers<T> {
|
||||
promise: Promise<T>;
|
||||
resolve: (value: T | PromiseLike<T>) => void;
|
||||
reject: (reason?: any) => void;
|
||||
}
|
||||
// TODO Docusaurus v4, remove temporary polyfill when upgrading to Node 22+
|
||||
export function promiseWithResolvers<T>(): PromiseWithResolvers<T> {
|
||||
// @ts-expect-error: it's fine
|
||||
const out: PromiseWithResolvers<T> = {};
|
||||
out.promise = new Promise((resolve, reject) => {
|
||||
out.resolve = resolve;
|
||||
out.reject = reject;
|
||||
});
|
||||
return out;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue