Files
contentstack-imagevault/rte/vite.config.ts
2024-03-26 11:53:20 +01:00

29 lines
808 B
TypeScript

import { resolve } from 'path';
import { defineConfig } from 'vite';
import tsconfigPaths from 'vite-tsconfig-paths';
export default defineConfig({
plugins: [tsconfigPaths()],
define: {
IS_DEV: process.env.IS_DEV === 'true' ? true : false,
},
publicDir: false,
build: {
sourcemap: process.env.IS_DEV ? 'inline' : 'hidden',
emptyOutDir: true,
lib: {
entry: resolve(__dirname, 'main.tsx'),
name: 'csiv',
fileName: () => (process.env.IS_DEV ? 'csiv.js' : 'csiv-[hash].js'),
// @ts-expect-error: 'system' not valid by typings, but works with Rollup
formats: ['system'],
},
rollupOptions: {
external: ['react', 'react-dom', '@contentstack/venus-components'],
output: {
dir: '../remix/public/build/rte',
},
},
},
});