storybook-framework-redwoodjs-vite
Version:
Storybook for RedwoodJS with Vite
20 lines (19 loc) • 456 B
JavaScript
function mockAuth() {
return {
name: "mock-@redwoodjs/auth",
enforce: "pre",
transform(code, id) {
if (id.includes("web/src/auth")) {
code = code.replace(
/(import\s*{\s*[^}]*)(\bcreateAuth\b)(,?)([^}]*})/,
"$1$4"
);
code = "import { createAuthentication as createAuth } from '@redwoodjs/testing/dist/web/mockAuth.js'\n" + code;
}
return code;
}
};
}
export {
mockAuth
};