Loading...
Loading...
Make a Remotion project ready for `npx shadcn add @remocn/<name>`: add the @remocn registry to components.json, the @/* path to tsconfig.json and the same alias to remotion.config.ts. Use before the first remocn component is installed into a project, or when shadcn add or the Remotion bundler can't resolve a remocn import.
npx skill4agent add remocn/remocn setupshadcn initpackage.jsonpackage.jsonremotiondependenciesdevDependenciesvideonpx create-video@latest --yes --blank <folder>components.json{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "new-york",
"rsc": false,
"tsx": true,
"tailwind": { "config": "", "css": "", "baseColor": "neutral", "cssVariables": false },
"aliases": {
"components": "@/components",
"utils": "@/lib/utils",
"ui": "@/components/ui",
"lib": "@/lib",
"hooks": "@/hooks"
},
"registries": { "@remocn": "https://remocn.dev/r/{name}.json" }
}registries["@remocn"]"@remocn": "https://remocn.dev/r/{name}.json"registries@remocn@/*tsconfig.json@/tsconfig.json@/compilerOptions.paths["@/*"]/*./src/*srccompilerOptions.baseUrltsconfig.jsonextendspathspaths@/*"@/*": ["./src/*"]src"@/*": ["./src/*"]compilerOptions.pathspathsbaseUrl.srcbaseUrlsrctsconfig.jsonsrc@remotion.config.tsremotion.config.tsremotion.config.jswithRemocnAliaspath.join(process.cwd(), "<alias folder>")process.cwd()remotion.config.tsremotion.config.tsimport path from "node:path";import { Config } from "@remotion/cli/config";remotion.config.jsconst withRemocnAlias = (config) => ({ ... })config.resolve?.alias ?? {}// remocn components import each other through the "@/" alias in components.json.
// Bundlers don't read tsconfig paths, so the alias is resolved here as well.
// Both overrides are deliberate: the Remotion CLI applies overrideBundlerConfig
// with webpack and rspack alike, while Remocn Studio's preview reads only
// overrideWebpackConfig. Both run from the project root, which process.cwd()
// points at.
const withRemocnAlias = <C extends { resolve?: object }>(config: C): C => ({
...config,
resolve: {
...config.resolve,
alias: {
...((config.resolve as { alias?: object } | undefined)?.alias ?? {}),
"@": path.join(process.cwd(), "src"),
},
},
});
// overrideBundlerConfig only exists in newer Remotion 4 releases.
if (typeof Config.overrideBundlerConfig === "function") {
Config.overrideBundlerConfig(withRemocnAlias);
}
Config.overrideWebpackConfig(withRemocnAlias);path.join(process.cwd(), "src")npx shadcn@latest add @remocn/<name>