Skip to content

Commit

Permalink
feat: add vite config 馃帀
Browse files Browse the repository at this point in the history
Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>
  • Loading branch information
vinayakkulkarni committed Nov 7, 2022
1 parent f8bf3c9 commit 7c3f765
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import vue from '@vitejs/plugin-vue';
import { resolve } from 'path';
import { defineConfig } from 'vite';
import pkg from './package.json';

const banner = `/*!
* ${pkg.name} v${pkg.version}
* (c) ${new Date().getFullYear()} ${pkg.author.name}
* @license ${pkg.license}
*/`;

export default defineConfig({
plugins: [vue()],
build: {
target: 'esnext',
minify: 'esbuild',
sourcemap: true,
lib: {
entry: resolve(__dirname, 'src/index.ts'),
name: 'VPip',
formats: ['es', 'cjs', 'umd'],
fileName: pkg.name,
},
commonjsOptions: {
extensions: ['.js', '.ts', '.vue'],
exclude: 'src/**',
include: 'node_modules/**',
},
rollupOptions: {
external: ['vue'],
output: {
exports: 'named',
banner,
strict: true,
sourcemap: true,
globals: {
vue: 'vue',
},
assetFileNames: (assetInfo) => {
if (assetInfo.name === 'style.css') return 'v-pip.css';
return assetInfo.name;
},
},
},
},
});

0 comments on commit 7c3f765

Please sign in to comment.