Vue + Inertia, SSR not working, the requested module does not provide
rinoj opened this issue Β· comments
Rinor commented
When running Inertia SSR, the modules are not found.
The error is as follows:
import { initTE, Collapse, Ripple } from "tw-elements";
SyntaxError: The requested module 'tw-elements' does not provide an export named 'Collapse'
The generated build file has this import file
import { initTE, Collapse, Ripple } from "tw-elements";
which leads to this file.
/node_modules/tw-elements/types/tw-elements.d.ts
declare module "tw-elements";
Igor Przybysz commented
Hi, try importing tw-elemets
package dynamically. It should fix this error. Check out also our Troubleshooting section in Vue Integration tutorial.
onMounted(async () => {
const { Collapse, Ripple, initTE } = await import("tw-elements");
initTE({ Collapse, Ripple });
});
Rinor commented
That fixed it, thank you.