parent
4acbd9900f
commit
a1e37fe1aa
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,14 @@ |
||||
<!doctype html> |
||||
<html lang="en"> |
||||
|
||||
<head> |
||||
<meta charset="utf-8" /> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1" /> |
||||
%sveltekit.head% |
||||
</head> |
||||
|
||||
<body data-sveltekit-preload-data="hover"> |
||||
<div style="display: contents">%sveltekit.body%</div> |
||||
</body> |
||||
|
||||
</html> |
||||
@ -1,17 +0,0 @@ |
||||
import App from "./App.svelte"; |
||||
import singleSpaSvelte from "single-spa-svelte"; |
||||
import { mount as mountSvelte } from "svelte"; |
||||
|
||||
function MountableApp(options: any) { |
||||
return mountSvelte(App, options); |
||||
} |
||||
|
||||
const svelteLifecycles = singleSpaSvelte({ |
||||
component: MountableApp, |
||||
domElementGetter: () => document.getElementById("svelte-app"), |
||||
props: {}, |
||||
}); |
||||
|
||||
export const bootstrap = svelteLifecycles.bootstrap; |
||||
export const mount = svelteLifecycles.mount; |
||||
export const unmount = svelteLifecycles.unmount; |
||||
@ -0,0 +1,23 @@ |
||||
export default function injectReactPreamble(origins: string[]) { |
||||
// Hack to inject react preamble.
|
||||
function appendReactRefreshScript(origin: string) { |
||||
const reactRefreshInteropabilityScript = document.createElement("script"); |
||||
reactRefreshInteropabilityScript.type = "module"; |
||||
reactRefreshInteropabilityScript.textContent = ` |
||||
import RefreshRuntime from '${origin}/@react-refresh'; |
||||
RefreshRuntime.injectIntoGlobalHook(window); |
||||
`;
|
||||
document.head.appendChild(reactRefreshInteropabilityScript); |
||||
} |
||||
|
||||
// @ts-ignore
|
||||
window.$RefreshReg$ = () => {}; |
||||
// @ts-ignore
|
||||
window.$RefreshSig$ = () => (type) => type; |
||||
// @ts-ignore
|
||||
window.__vite_plugin_react_preamble_installed__ = true; |
||||
|
||||
origins.forEach((origin) => { |
||||
appendReactRefreshScript(origin); |
||||
}); |
||||
} |
||||
@ -1,25 +0,0 @@ |
||||
import "./app.css"; |
||||
import { registerApplication, start } from "single-spa"; |
||||
import * as singleSpaSvelte from "./host-svelte.single-spa"; |
||||
import { init } from "@module-federation/enhanced/runtime"; |
||||
|
||||
init({ name: "host-svelte", remotes: [] }); |
||||
|
||||
registerApplication( |
||||
"host-svelte", |
||||
singleSpaSvelte, |
||||
(location) => true || location.pathname.startsWith("/app2"), |
||||
{ some: "value" }, |
||||
); |
||||
|
||||
start(); |
||||
|
||||
// import { mount } from 'svelte'
|
||||
// import './app.css'
|
||||
// import App from './App.svelte'
|
||||
|
||||
// const app = mount(App, {
|
||||
// target: document.getElementById('app')!,
|
||||
// })
|
||||
|
||||
// export default app
|
||||
@ -1,28 +0,0 @@ |
||||
<single-spa-router mode="hash"> |
||||
<!-- |
||||
|
||||
This is the single-spa Layout Definition for your microfrontends. |
||||
See https://single-spa.js.org/docs/layout-definition/ for more information. |
||||
|
||||
--> |
||||
|
||||
<!-- Example layouts you might find helpful: |
||||
|
||||
<nav> |
||||
<application name="@org/navbar"></application> |
||||
</nav> |
||||
<route path="settings"> |
||||
<application name="@org/settings"></application> |
||||
</route> |
||||
|
||||
--> |
||||
|
||||
<main> |
||||
<route default> |
||||
<application name="@single-spa/welcome"></application> |
||||
</route> |
||||
<route path="welcome"> |
||||
<application name="@single-spa/welcome"></application> |
||||
</route> |
||||
</main> |
||||
</single-spa-router> |
||||
@ -0,0 +1 @@ |
||||
export const ssr = false; |
||||
@ -0,0 +1,18 @@ |
||||
<script> |
||||
// Import shared dependencies so they are included in the build. |
||||
import "react"; |
||||
import "react-dom"; |
||||
import "react-dom/client"; |
||||
import "react/jsx-runtime"; |
||||
import "react/jsx-dev-runtime"; |
||||
|
||||
import "../app.css"; |
||||
|
||||
import injectReactPreamble from "../injectReactPreamble"; |
||||
|
||||
if (import.meta.env.DEV) { |
||||
injectReactPreamble(["http://localhost:5001", "http://localhost:5002"]); |
||||
} |
||||
</script> |
||||
|
||||
<slot /> |
||||
@ -0,0 +1,5 @@ |
||||
<script lang="ts"> |
||||
import App from "../App.svelte"; |
||||
</script> |
||||
|
||||
<App /> |
||||
@ -0,0 +1,13 @@ |
||||
import adapter from "@sveltejs/adapter-static"; |
||||
|
||||
/** @type {import('@sveltejs/kit').Config} */ |
||||
const config = { |
||||
kit: { |
||||
// adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list.
|
||||
// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
|
||||
// See https://svelte.dev/docs/kit/adapters for more information about adapters.
|
||||
adapter: adapter({ fallback: "app.html" }), |
||||
}, |
||||
}; |
||||
|
||||
export default config; |
||||
Loading…
Reference in new issue