InvokeAI/invokeai/frontend/web/config/vite.package.config.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

51 lines
1.4 KiB
TypeScript
Raw Normal View History

2023-04-28 05:44:27 +00:00
import react from '@vitejs/plugin-react-swc';
import path from 'path';
import { visualizer } from 'rollup-plugin-visualizer';
import { PluginOption, UserConfig } from 'vite';
import dts from 'vite-plugin-dts';
2023-04-28 05:44:27 +00:00
import eslint from 'vite-plugin-eslint';
import tsconfigPaths from 'vite-tsconfig-paths';
import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js';
2023-04-28 05:44:27 +00:00
export const packageConfig: UserConfig = {
base: './',
2023-04-28 05:44:27 +00:00
plugins: [
react(),
eslint(),
tsconfigPaths(),
visualizer() as unknown as PluginOption,
dts({
insertTypesEntry: true,
}),
cssInjectedByJsPlugin(),
2023-04-28 05:44:27 +00:00
],
build: {
cssCodeSplit: true,
2023-04-28 05:44:27 +00:00
lib: {
entry: path.resolve(__dirname, '../src/index.ts'),
name: 'InvokeAIUI',
fileName: (format) => `invoke-ai-ui.${format}.js`,
},
rollupOptions: {
2023-04-28 11:25:25 +00:00
external: ['react', 'react-dom', '@emotion/react'],
2023-04-28 05:44:27 +00:00
output: {
globals: {
react: 'React',
2023-04-28 11:25:25 +00:00
'react-dom': 'ReactDOM',
'@emotion/react': 'EmotionReact',
2023-04-28 05:44:27 +00:00
},
},
},
},
2023-04-28 11:25:25 +00:00
resolve: {
alias: {
app: path.resolve(__dirname, '../src/app'),
assets: path.resolve(__dirname, '../src/assets'),
common: path.resolve(__dirname, '../src/common'),
features: path.resolve(__dirname, '../src/features'),
services: path.resolve(__dirname, '../src/services'),
theme: path.resolve(__dirname, '../src/theme'),
},
},
2023-04-28 05:44:27 +00:00
};