webstudio/vite.sdk-components.config.ts
Bogdan Chadkin a32d6329ed refactor: add templates meta support (#4653)
Here added one more description file for components `*.template.tsx`.

It is decoupled from component meta to fix the issue with some templates
like Sheet being treated as components though we don't have actual
components with this name.

Another reason is have it separately to not include builder specific
code and dependencies into CLI and published websites. Template package
is defined as optional in peer dependencies meta.

In this PR migrated only Button and List as examples. There is still not
support for data sources and styles.

Added support for text placeholders in children
2024-12-25 21:37:15 +07:00

32 lines
638 B
TypeScript

import { defineConfig } from "vite";
const isBareImport = (id: string) =>
id.startsWith("@") || id.includes(".") === false;
export default defineConfig({
// resolve only webstudio condition in tests
resolve: {
conditions: ["webstudio"],
},
build: {
lib: {
entry: [
"src/components.ts",
"src/metas.ts",
"src/props.ts",
"src/hooks.ts",
"src/templates.ts",
],
formats: ["es"],
},
rollupOptions: {
external: isBareImport,
output: {
preserveModules: true,
preserveModulesRoot: "src",
dir: "lib",
},
},
},
});