mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-28 11:41:04 +00:00
59 lines
1.4 KiB
TypeScript
59 lines
1.4 KiB
TypeScript
/**
|
|
* @license
|
|
* Copyright 2025 Qwen Team
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import { defineConfig } from 'vite';
|
|
import react from '@vitejs/plugin-react';
|
|
import dts from 'vite-plugin-dts';
|
|
import { resolve } from 'path';
|
|
|
|
/**
|
|
* Vite configuration for @qwen-code/webui library
|
|
*
|
|
* Build outputs:
|
|
* - ESM: dist/index.js (primary format)
|
|
* - CJS: dist/index.cjs (compatibility)
|
|
* - UMD: dist/index.umd.js (for CDN usage)
|
|
* - TypeScript declarations: dist/index.d.ts
|
|
* - CSS: dist/styles.css (optional styles)
|
|
*/
|
|
export default defineConfig({
|
|
plugins: [
|
|
react(),
|
|
dts({
|
|
include: ['src'],
|
|
outDir: 'dist',
|
|
rollupTypes: true,
|
|
insertTypesEntry: true,
|
|
}),
|
|
],
|
|
build: {
|
|
lib: {
|
|
entry: resolve(__dirname, 'src/index.ts'),
|
|
name: 'QwenCodeWebUI',
|
|
formats: ['es', 'cjs', 'umd'],
|
|
fileName: (format) => {
|
|
if (format === 'es') return 'index.js';
|
|
if (format === 'cjs') return 'index.cjs';
|
|
if (format === 'umd') return 'index.umd.js';
|
|
return 'index.js';
|
|
},
|
|
},
|
|
rollupOptions: {
|
|
external: ['react', 'react-dom', 'react/jsx-runtime'],
|
|
output: {
|
|
globals: {
|
|
react: 'React',
|
|
'react-dom': 'ReactDOM',
|
|
'react/jsx-runtime': 'jsxRuntime',
|
|
},
|
|
assetFileNames: 'styles.[ext]',
|
|
},
|
|
},
|
|
sourcemap: true,
|
|
minify: false,
|
|
cssCodeSplit: false,
|
|
},
|
|
});
|