ui-lib/vite.build.js

75 lines
1.6 KiB
JavaScript

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: ['umd'],
fileName: (_format, name) => `${name}.min.js`
},
rollupOptions: {
output: {
assetFileNames: info => info.name === 'style.css' ? 'ui.min.css' : info.name
}
},
sourcemap: true,
emptyOutDir: false
}
},
{
clearScreen: false,
css: {
postcss: {
plugins: [postcssPresetEnv()]
}
},
build: {
lib: {
entry: './lib/app.js',
name: 'lib-app',
formats: ['umd'],
fileName: (_format, name) => `${name}.min.js`
},
rollupOptions: {
output: {
assetFileNames: info => info.name === 'style.css' ? 'app.min.css' : info.name
}
},
sourcemap: true,
outDir: '../../../../IronIntel/Contractor2.0/Contractor/Site/js/lib',
emptyOutDir: false
},
plugins: [
viteExternalsPlugin({
'../../ui': 'lib-ui',
'../../utility': 'lib-utility'
})
]
},
{
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))