From 324539625f6de5c6bb572dd428372dd961362531 Mon Sep 17 00:00:00 2001 From: Marcin Wojtala Date: Thu, 6 Jun 2024 10:36:15 +0100 Subject: [PATCH] Update ecosystem-vite.md for v0.4+ https://github.com/WJSoftware/vite-plugin-single-spa?tab=readme-ov-file#mounting-and-unmounting-css --- versioned_docs/version-6.x/ecosystem-vite.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/versioned_docs/version-6.x/ecosystem-vite.md b/versioned_docs/version-6.x/ecosystem-vite.md index f8f36ef1d..225d16865 100644 --- a/versioned_docs/version-6.x/ecosystem-vite.md +++ b/versioned_docs/version-6.x/ecosystem-vite.md @@ -96,10 +96,10 @@ export default defineConfig({ import React from 'react'; import ReactDOMClient from 'react-dom/client'; -// @ts-ignore +// @ts-expect-error import singleSpaReact from 'single-spa-react'; import App from './App'; -import { cssLifecycle } from 'vite-plugin-single-spa/ex'; +import { cssLifecycleFactory } from 'vite-plugin-single-spa/ex'; const lc = singleSpaReact({ React, @@ -109,10 +109,12 @@ const lc = singleSpaReact({ return
Error: {err}
} }); - -export const bootstrap = [cssLifecycle.bootstrap, lc.bootstrap]; -export const mount = [cssLifecycle.mount, lc.mount]; -export const unmount = [cssLifecycle.unmount, lc.unmount]; +// IMPORTANT: Because the file is named spa.tsx, the string 'spa' +// must be passed to the call to cssLifecycleFactory. +const cssLc = cssLifecycleFactory('spa', /* optional factory options */); +export const bootstrap = [cssLc.bootstrap, lc.bootstrap]; +export const mount = [cssLc.mount, lc.mount]; +export const unmount = [cssLc.unmount, lc.unmount]; ``` ### Main Features