Created
August 19, 2023 17:02
-
-
Save harpreetkhalsagtbit/dbda5b0f675681f3ea16e5d7af366b2e to your computer and use it in GitHub Desktop.
vite-config-with-separate-json-bundle.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { resolve } from 'node:path' | |
import libAssetsPlugin from '@laynezh/vite-plugin-lib-assets' | |
import { terser } from 'rollup-plugin-terser'; | |
import { defineConfig } from 'vite' | |
// https://vitejs.dev/config/ | |
export default defineConfig(() => ({ | |
plugins: [ | |
libAssetsPlugin({ | |
include: /\.a?json(\?.*)?$/ | |
}) | |
], | |
build: { | |
minify:true, | |
outDir: 'dist', // Specify the output directory for the build | |
lib: { | |
entry: resolve('src', 'index.ts'), | |
name: 'country-state-city', | |
formats: ['es', 'cjs', 'umd'], | |
fileName: (format) => `country-state-city.${format}.js`, | |
}, | |
manifest: true, | |
rollupOptions: { | |
plugins: [ | |
terser() | |
] | |
}, | |
} | |
})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment