fix(vite): nested islands not working (#3440)
This PR makes nested islands work. Problem was that only entry files have the `src` property in the vite manifest. For that we need to ensure that every island is an entry point. Fixes https://github.com/denoland/fresh/issues/3439
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import { useEffect, useState } from "preact/hooks";
|
||||
|
||||
export function IslandNestedInner() {
|
||||
const [ready, set] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
set(true);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div class={ready ? "inner-ready" : ""}>
|
||||
<p>Inner</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { useEffect, useState } from "preact/hooks";
|
||||
import { IslandNestedInner } from "./IslandNestedInner.tsx";
|
||||
|
||||
export function IslandNestedOuter() {
|
||||
const [ready, set] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
set(true);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div class={ready ? "outer-ready" : ""}>
|
||||
<p>Outer</p>
|
||||
<IslandNestedInner />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
export { RemoteIsland } from "@marvinh-test/fresh-island";
|
||||
@@ -0,0 +1,9 @@
|
||||
import { IslandNestedOuter } from "../../islands/IslandNestedOuter.tsx";
|
||||
|
||||
export default function Page() {
|
||||
return (
|
||||
<div>
|
||||
<IslandNestedOuter />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -6,7 +6,9 @@ import tailwind from "@tailwindcss/vite";
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
inspect(),
|
||||
fresh(),
|
||||
fresh({
|
||||
islandSpecifiers: ["@marvinh-test/fresh-island"],
|
||||
}),
|
||||
tailwind(),
|
||||
],
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user