Skip to content

Commit 62c43d2

Browse files
committed
chore: add import.meta.glob test
1 parent 4119a70 commit 62c43d2

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import "../styles/lazyGlob.css";
2+
3+
const Lazy = () => {
4+
return <></>
5+
}
6+
7+
export default Lazy;

apps/fixtures/css/src/components/test.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,13 @@ export const CommonTests = (props: { routeModuleClass?: string }) => (
7070
comment="FOUC during client-side navigation, on Chrome."
7171
/>
7272
<Test component="Route" file="notRendered.css" class="notRendered" integration="url" invert />
73+
<Test component="Lazy" file="lazy.css" class="lazy" lazy />
7374
<Test
74-
component="Lazy"
75-
file="lazy.css"
76-
class="lazy"
75+
component="LazyGlob"
76+
file="lazyGlob.css"
77+
class="lazyGlob"
7778
lazy
79+
comment={'Imported via "import.meta.glob".'}
7880
/>
7981
<Test
8082
component="LazyLink"

apps/fixtures/css/src/routes/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ const LazyMountAssets = lazy(() => import("../components/lazyMountAssets"));
1313
const LazyLinkTmp = lazy(() => import("../components/lazyLinkTmp"));
1414
const LazyMountAssetsTmp = lazy(() => import("../components/lazyMountAssetsTmp"));
1515

16+
const entries = import.meta.glob("../components/lazyG*.tsx");
17+
const LazyGlob = lazy(Object.values(entries)[0] as any);
18+
1619
const getData = query(async () => {
1720
"use server";
1821
await new Promise(res => setTimeout(res, 1000));
@@ -29,6 +32,7 @@ export default function Home() {
2932
<link rel="stylesheet" href={notRenderedInlineCSS} />
3033
</Show>
3134
<Lazy />
35+
<LazyGlob />
3236
<LazyLink />
3337
<LazyMountAssets />
3438
<Show when={!data()}>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.lazyGlob {
2+
background-color: var(--color-success);
3+
}

0 commit comments

Comments
 (0)