Drop-in replacement for solids lazy utility, supporting ssr of lazy loaded css.
  • TypeScript 100%
Find a file
2024-10-31 17:32:04 +01:00
.changeset v0.4.1 2024-10-31 17:32:04 +01:00
src fix: properly normalize module ids on non-posix systems 2024-10-31 17:29:11 +01:00
.gitignore chore: initial commit 2024-03-29 16:49:11 +01:00
.npmignore fix: include all files in npm 2024-03-29 16:56:23 +01:00
.prettierignore chore: initial commit 2024-03-29 16:49:11 +01:00
CHANGELOG.md v0.4.1 2024-10-31 17:32:04 +01:00
LICENSE chore: initial commit 2024-03-29 16:49:11 +01:00
package.json v0.4.1 2024-10-31 17:32:04 +01:00
pnpm-lock.yaml chore: update dev dependencies 2024-10-31 17:31:05 +01:00
README.md docs: explain functionality in README.md 2024-03-29 18:02:22 +01:00
tsconfig.json chore: initial commit 2024-03-29 16:49:11 +01:00

Solid Lazy Plus

This is a drop-in replacement for Solids lazy utility specifically to be used in SolidStart projects. Compared to the original, this has the ability to properly register css assets of lazy loaded components during server-side rendering, in production builds.

This is experimental, third-party functionality and hopefully will be integrated into an official solid package, if it proves useful.

Vinxi configuration (app.config.ts)

import { defineConfig } from "@solidjs/start/config";
import lazyPlusPlugin from "solid-lazy-plus/vite";

export default defineConfig({
  vite(options) {
    return {
      plugins: [lazyPlusPlugin({ router: options.router })],
    };
  },
});

Usage

import { lazy } from "solid-lazy-plus";

// wrap import
const ComponentA = lazy(() => import("./ComponentA"));

// use in JSX
<ComponentA title={props.title} />;