Skip to content

Instantly share code, notes, and snippets.

@yusukebe
Created June 3, 2024 11:41
Show Gist options
  • Save yusukebe/14e91db4ecd4b7e667041dac8ad7695d to your computer and use it in GitHub Desktop.
Save yusukebe/14e91db4ecd4b7e667041dac8ad7695d to your computer and use it in GitHub Desktop.
import { defineConfig } from 'vite'
import glob from 'glob'
import { terser } from 'rollup-plugin-terser'
const entryPoints = glob.sync('./src/**/*.ts', {
ignore: ['./src/**/*.test.ts', './src/test-utils/**/*.ts', './src/deno/**/*.ts'],
})
export default defineConfig({
build: {
target: 'es2022',
lib: {
entry: entryPoints,
},
minify: false,
rollupOptions: {
plugins: [
terser({
compress: false, // 圧縮を無効にする
mangle: false, // 名前の難読化を無効にする
format: {
comments: false,
},
}),
],
output: [
{
preserveModules: true,
exports: 'named',
dir: './dist/cjs',
format: 'cjs',
},
{
preserveModules: true,
exports: 'named',
dir: './dist',
format: 'es',
},
],
},
},
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment