-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvite.config.ts
54 lines (51 loc) · 1.61 KB
/
vite.config.ts
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
import path from 'path'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import svgLoader from 'vite-svg-loader'
import crypto from 'crypto';
import renameNodeModules from "rollup-plugin-rename-node-modules";
import autoprefixer from 'autoprefixer'
// Fix build for Node version with OpenSSL 3
const origCreateHash = crypto.createHash;
crypto.createHash = (alg: string, opts: crypto.HashOptions | undefined) => {
return origCreateHash(alg === 'md4' ? 'md5' : alg, opts);
};
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
svgLoader({ svgo: false }),
renameNodeModules('modules'),
],
css: {
postcss: {
plugins: [
autoprefixer(),
],
}
},
build: {
lib: {
entry: path.resolve(__dirname, 'src/main.ts'),
// name: 'NimiqVue3Components',
formats: ['es'],
},
sourcemap: true,
rollupOptions: {
// make sure to externalize deps that shouldn't be bundled
// into your library
external: ['vue', 'js-sha3'],
output: {
// Generate one file per component,
// but since it create a node_module folder that get removed during the packaging then it doesn't work
preserveModules: true,
preserveModulesRoot: '.',
// Provide global variables to use in the UMD build
// for externalized deps
globals: {
vue: 'Vue'
}
}
}
}
})