mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-14 05:42:32 +00:00
This is a fresh start for the `artcraft` repo. The old monorepo, which included our web API gateway, job services, SRE tools, various frontends, and more has moved to `artcraft-services` You can find the full git history here: https://github.com/storytold/artcraft-services This change was motivated by the fact that the entire git history was hundreds of gigabytes in size, which is unwieldy for anyone not in the core team that doesn't care about support services outside of the core artcraft app. We wanted to keep this repo in its well-known place since we already have users and activity here. Please update your remotes to either `artcraft-services` or make a fresh clone of this repo. History can be found at the artcraft-services repo.
82 lines
2.2 KiB
TypeScript
82 lines
2.2 KiB
TypeScript
/// <reference types='vitest' />
|
|
import { defineConfig } from 'vite';
|
|
import react from '@vitejs/plugin-react';
|
|
import dts from 'vite-plugin-dts';
|
|
import wasm from 'vite-plugin-wasm';
|
|
import * as path from 'path';
|
|
import { isExternal as baseIsExternal } from '../../shared-vite-config';
|
|
|
|
// OpenCut peer deps that should NEVER bundle into the lib output.
|
|
// Consuming apps add these directly to their package.json.
|
|
const EXTRA_EXTERNAL_PREFIXES = [
|
|
'opencut-wasm',
|
|
'mediabunny',
|
|
'wavesurfer.js',
|
|
'soundtouchjs',
|
|
'@huggingface/transformers',
|
|
'@radix-ui/',
|
|
'@dnd-kit/',
|
|
'react-hook-form',
|
|
'class-variance-authority',
|
|
'clsx',
|
|
'tailwind-merge',
|
|
'lucide-react',
|
|
'sonner',
|
|
'cmdk',
|
|
'@hugeicons/',
|
|
'use-deep-compare-effect',
|
|
'react-router-dom',
|
|
'framer-motion',
|
|
'react-resizable-panels',
|
|
];
|
|
|
|
function isExternal(id: string): boolean {
|
|
if (baseIsExternal(id)) return true;
|
|
for (const prefix of EXTRA_EXTERNAL_PREFIXES) {
|
|
if (id === prefix || id.startsWith(prefix)) return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
export default defineConfig(() => ({
|
|
root: __dirname,
|
|
cacheDir: '../../../node_modules/.vite/libs/components/video-editor',
|
|
plugins: [react(), wasm(), dts({ entryRoot: 'src', tsconfigPath: path.join(__dirname, 'tsconfig.lib.json') })],
|
|
build: {
|
|
outDir: './dist',
|
|
emptyOutDir: true,
|
|
reportCompressedSize: true,
|
|
commonjsOptions: {
|
|
transformMixedEsModules: true,
|
|
},
|
|
lib: {
|
|
entry: 'src/index.ts',
|
|
name: '@storyteller/ui-video-editor',
|
|
fileName: 'index',
|
|
formats: ['es' as const]
|
|
},
|
|
rollupOptions: {
|
|
external: isExternal
|
|
},
|
|
},
|
|
test: {
|
|
watch: false,
|
|
globals: true,
|
|
environment: 'jsdom',
|
|
include: ['{src,tests}/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
reporters: ['default'],
|
|
// opencut-wasm is published as ESM with a .wasm asset; vitest's default
|
|
// resolver hits the .wasm file directly without going through vite's
|
|
// transform pipeline. Inlining the package forces vite to process it.
|
|
server: {
|
|
deps: {
|
|
inline: [/opencut-wasm/],
|
|
},
|
|
},
|
|
coverage: {
|
|
reportsDirectory: './test-output/vitest/coverage',
|
|
provider: 'v8' as const,
|
|
}
|
|
},
|
|
}));
|