Skip to content

Image component as a standalone package#2111

Draft
atilafassina wants to merge 11 commits intofeat-imagefrom
standalone-image
Draft

Image component as a standalone package#2111
atilafassina wants to merge 11 commits intofeat-imagefrom
standalone-image

Conversation

@atilafassina
Copy link
Copy Markdown
Member

This PR introduces @solidjs/image, a new standalone package for image optimization in SolidStart applications. The image component is extracted from the core @solidjs/start package to allow for better modularity and independent versioning.

Changes

features moved to a standalone package @solidjs/image

  • Vite plugin for build-time image optimization using sharp
  • <Image> component with support for:
    • Local and remote images
    • Lazy loading with fallback
    • Aspect ratio preservation
    • CSS-based styling
  • Transformers for processing images at build time
  • Hash-based caching for optimized assets
  • sharp (^0.34.5) is a dependency of this package

@solidjs/start changes in relation to feat-image branch

  • Removed image re-export from the main package (no longer bundles image functionality)

Test & Fixture Apps

  • Added apps/fixtures/image - demo application
  • Added image tests in apps/tests for local and remote scenarios

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 16, 2026

⚠️ No Changeset found

Latest commit: de45e5b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@atilafassina atilafassina changed the title add fixture-image app and setup standalone component Image component as a standalone package Mar 16, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 16, 2026

Open in StackBlitz

npm i https://pkg.pr.new/solidjs/solid-start/@solidjs/image@2111
npm i https://pkg.pr.new/solidjs/solid-start/@solidjs/start@2111
npm i https://pkg.pr.new/solidjs/solid-start/@solidjs/vite-plugin-nitro-2@2111

commit: de45e5b

Configure tsdown to output preserved JSX via Rolldown's jsx: "preserve"
option. Update package.json exports to use solid/default conditions
pointing to dist/index.jsx. Add CSS copy step to build script.

Co-authored-by: Isaac
Add Vitest config and 16 tests across two suites:
- transformer.test.ts: createImageVariants, mergeImageVariantsByType,
  mergeImageVariantsToSrcSet (7 tests)
- components.test.tsx: createLazyRender, createClientSignal, ClientOnly,
  StartImage SSR regression (9 tests)

Co-authored-by: Isaac
Change external from literal "*.css" to regex /\.css$/ so Rolldown
actually matches the import "./styles.css" and preserves it in the
output instead of extracting it to a separate file.

Without this, the component's positioning CSS never loads and the
image is clipped to zero height by overflow:hidden.

Co-authored-by: Isaac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant