Add a third-party package
You want a carousel, a map or a date library, and you need to know where it may run and what it costs.
Goal
Install a library, import it from the right side of the server/client line, and keep the bundle inside the ceilings the platform publishes against.
Prerequisites
The workspace from Start, and Server and client — whether a package may run in a renderer at all is decided there, and it is the question this recipe turns on.
Steps
1. Install it, and commit the lockfile
npm install embla-carousel-reactDeclare only what the template itself imports. TypeScript, ESLint, the bundler and Tailwind are the framework's own dependencies, installed beside it, so the workspace declares none of them.
The lockfile is what every dependency gate is measured from: without one nothing
can be graded (dependencies/lockfile-missing),
and one that no longer satisfies package.json is
dependencies/lockfile-stale. A package
that drags in its own React is
dependencies/single-react; a high or
critical advisory is
dependencies/audit-severity.
2. Decide which side of the line it runs on
A renderer is a pure server function: no state, no effects, no event handlers, no
network, no browser globals. A package that needs any of those may only be
imported from a "use client" island — importing it into a section is
server/no-client-runtime, reported against
your module rather than against the package.
Formatting, geometry and data helpers are fine in a renderer. Anything that mounts, listens or measures is an island.
// The carousel package is the reader's dependency, not this site's, so the
// import resolves in your workspace and in no fence here.
// @noErrors
"use client";
import type { IslandEditor } from "@homepages/concrete";
import useEmblaCarousel from "embla-carousel-react";
export const editor = { live: true } satisfies IslandEditor;
export function Carousel({ urls }: { urls: string[] }) {
const [ref] = useEmblaCarousel({ loop: true });
return (
<div ref={ref} className="overflow-hidden">
{urls.map((url) => (
<img key={url} src={url} alt="" className="w-full shrink-0" />
))}
</div>
);
}Props written to an island cross a serialization boundary, so pass the urls and the strings — never a function, a class instance or a slot binding.
3. Import the package's stylesheet where you use it
A package that ships a stylesheet is imported like any other, from a section, an
island or a component, and it reaches the compiled template stylesheet through the
CSS import graph in the order the modules evaluate. There is nothing to register,
and no local .css file needed to re-import it from.
// The carousel package is the reader's dependency, not this site's, so the
// import resolves in your workspace and in no fence here.
// @noErrors
import "swiper/css";A subpath that does not name the file, like the one above, typechecks because the
package ships types for it; one whose package does not is imported from one of
your own stylesheets instead, with an @import, which is also the only place a
layer can be named for it.
4. Read what it weighs
Every concrete check run prints each placed section's built weights — the
renderer, each island chunk and each asset:
✓ bundles
hero renderer 7.9 KB gzipThe ceilings are platform acceptance criteria, not preferences, and no flag
raises one: a section's renderer bundle stops at 300 KB gzip
(bundles/renderer-size) and an island chunk at
1 MB gzip (bundles/island-size). If a package
takes you past one, import the entry point you actually need rather than the
barrel — an icon set re-exported from one module puts the whole set in the chunk.
A package that cannot be bundled at all is
bundles/build-failed.
Verify
Run concrete dev and exercise the thing in the playground's live view, where
the island actually mounts — a package that needs the DOM fails there and nowhere
else. Then run concrete check: the lint stage grades the server/client line,
the dependencies stage grades the lockfile and the advisories, and the bundles
stage weighs what you added.
