feat: vue3渲染适配器
This commit is contained in:
68
packages/renderer-adapter/vue3/vite.config.ts
Normal file
68
packages/renderer-adapter/vue3/vite.config.ts
Normal file
@@ -0,0 +1,68 @@
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
import { defineConfig } from 'vite';
|
||||
import dts from 'vite-plugin-dts';
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
export default defineConfig({
|
||||
build: {
|
||||
cssCodeSplit: true,
|
||||
lib: {
|
||||
entry: path.resolve(__dirname, 'src/index.ts'),
|
||||
fileName: (format) => {
|
||||
switch (format) {
|
||||
case 'cjs': {
|
||||
return 'index.cjs';
|
||||
}
|
||||
case 'es': {
|
||||
return 'index.mjs';
|
||||
}
|
||||
case 'umd': {
|
||||
return 'index.js';
|
||||
}
|
||||
default: {
|
||||
return `index.${format}.js`;
|
||||
}
|
||||
}
|
||||
},
|
||||
formats: ['es', 'cjs', 'umd'],
|
||||
name: 'RendererAdapter',
|
||||
},
|
||||
outDir: 'dist',
|
||||
rollupOptions: {
|
||||
external: ['vue'],
|
||||
output: {
|
||||
assetFileNames: (assetInfo) => {
|
||||
if (assetInfo.name === 'style.css') return 'assets/[name][extname]';
|
||||
return 'assets/[name]-[hash][extname]';
|
||||
},
|
||||
globals: {
|
||||
vue: 'Vue',
|
||||
},
|
||||
},
|
||||
},
|
||||
sourcemap: true,
|
||||
},
|
||||
css: {
|
||||
extract: false,
|
||||
modules: {
|
||||
localsConvention: 'camelCaseOnly',
|
||||
scopeBehaviour: 'local',
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
vue({
|
||||
css: {
|
||||
injectCss: true,
|
||||
},
|
||||
}),
|
||||
dts({
|
||||
insertTypesEntry: true,
|
||||
outDir: 'dist/types',
|
||||
staticImport: true,
|
||||
}),
|
||||
],
|
||||
});
|
||||
Reference in New Issue
Block a user