Skip to content

Commit

Permalink
Fixed import
Browse files Browse the repository at this point in the history
  • Loading branch information
msenechal committed Mar 4, 2024
1 parent 7196df6 commit 67cd3c8
Show file tree
Hide file tree
Showing 4 changed files with 637 additions and 1,000 deletions.
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.21.3",
"tailwindcss": "^3.4.1",
"vite-plugin-single-spa": "^0.6.1"
"single-spa": "^6.0.1",
"single-spa-react": "^6.0.1",
"tailwindcss": "^3.4.1"
},
"devDependencies": {
"@types/node": "^20.11.16",
Expand All @@ -37,6 +38,7 @@
"eslint-plugin-react-refresh": "^0.4.3",
"prettier": "^2.7.1",
"typescript": "^5.0.2",
"vite": "^4.4.5"
"vite": "^4.4.5",
"vite-plugin-single-spa": "^0.6.1"
}
}
20 changes: 20 additions & 0 deletions src/spa.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from 'react';
import ReactDOMClient from 'react-dom/client';
import singleSpaReact from 'single-spa-react';
import App from './App';
import { cssLifecycleFactory } from 'vite-plugin-single-spa/ex';

const lc = singleSpaReact({
React,
ReactDOMClient,
rootComponent: App,
errorBoundary(err: any, _info: any, _props: any) {
return <div>Error: {err}</div>;
},
});
// IMPORTANT: Because the file is named spa.tsx, the string 'spa'
// must be passed to the call to cssLifecycleFactory.
const cssLc = cssLifecycleFactory('spa');
export const bootstrap = [cssLc.bootstrap, lc.bootstrap];
export const mount = [cssLc.mount, lc.mount];
export const unmount = [cssLc.unmount, lc.unmount];
4 changes: 3 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ export default defineConfig({
plugins: [
react(),
vitePluginSingleSpa({
type: 'root',
type: 'mife',
serverPort: 80,
spaEntryPoints: 'src/spa.tsx',
}),
],
define: {
Expand Down
Loading

0 comments on commit 67cd3c8

Please sign in to comment.