forked from ritterim/platform-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
52 lines (50 loc) · 1.24 KB
/
vite.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// vite.config.js
const { defineConfig } = require('vite');
const path = require('path');
import banner from 'vite-plugin-banner';
import handlebars from 'vite-plugin-handlebars';
import autoprefixer from 'autoprefixer';
import { resolve } from 'path';
const pjson = require('./package.json');
const year = new Date().getFullYear();
const puiHeader = [
'/*',
' Platform UI v' + pjson.version + ' | ' + pjson.name + '\n',
' ' + pjson.description + ' (' + pjson.homepage + ')',
' ©' + year + ' ' + pjson.author,
' ' + pjson.bugs.url,
' Released under the ' + pjson.license + ' license.',
'*/',
'',
].join('\n');
export default defineConfig({
plugins: [
banner(puiHeader),
handlebars()
],
css: {
postcss: {
plugins: [autoprefixer],
},
},
build: {
rollupOptions: {
input: {
main: resolve(__dirname, 'main.js')
},
output: {
assetFileNames: (assetInfo) => {
if (assetInfo.name === 'style.css') return 'platform-ui.min.css';
return assetInfo.name;
},
entryFileNames: 'js/platform-ui.min.js',
},
},
minify: true,
lib: {
entry: path.resolve(__dirname, 'main.js'),
name: 'PlatformUI',
formats: ['cjs']
},
},
});