import { build } from "vite"; import postcssPresetEnv from "postcss-preset-env"; import { viteExternalsPlugin } from "vite-plugin-externals"; const libraries = [ { clearScreen: false, css: { postcss: { plugins: [postcssPresetEnv()] } }, build: { lib: { entry: './lib/ui.js', name: 'lib-ui', formats: ['cjs', 'umd'], fileName: (format, name) => format === 'cjs' ? `${name}-cjs.min.js` : `${name}.min.js` }, rollupOptions: { output: { assetFileNames: info => info.name === 'style.css' ? 'ui.min.css' : info.name } }, sourcemap: true, emptyOutDir: false } }, { clearScreen: false, build: { lib: { entry: './lib/utility.js', name: 'lib-utility', formats: ['umd'], fileName: (_format, name) => `${name}.min.js` }, sourcemap: true, emptyOutDir: false } } ] libraries.forEach(async b => await build(b))