forked from filipinascimento/helios-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
55 lines (49 loc) · 1.29 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
53
54
// vite.config.js
import { resolve } from 'path'
import { defineConfig } from 'vite'
import * as path from 'path';
import * as fs from 'fs';
function stripDocumentationFromBuild () {
return {
name: 'strip-build-docs',
resolveId (source) {
return source === 'virtual-module' ? source : null
},
renderStart (outputOptions, inputOptions) {
const outDir = outputOptions.dir
const docsDir = path.resolve(outDir, 'docs')
fs.rm(docsDir, { recursive: true }, () => console.log(`Deleted ${docsDir}`))
const indexFile = path.resolve(outDir, 'index.html')
fs.rm(indexFile, () => console.log(`Deleted ${indexFile}`))
}
}
}
/** @type {import('vite').UserConfig} */
export default defineConfig({
// optimizeDeps: {
// esbuildOptions: { target: "es2020", supported: { bigint: true } },
// },
// esbuild: {
// target: "es2020"
// },
plugins: [stripDocumentationFromBuild()],
build: {
target: "esnext",
sourcemap: true,
lib: {
entry: resolve(__dirname, 'src/helios.js'),
name: 'helios',
// the proper extensions will be added
fileName: 'helios'
},
minify: "esbuild",
},
server: {
open: '/docs/example/index.html'
},
test: {
/* for example, use global to avoid globals imports (describe, test, expect): */
// globals: true,
environment: "jsdom"
},
});