forked from ieskudero/three-dxf-viewer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.page.config.js
54 lines (51 loc) · 1.32 KB
/
vite.page.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
import { defineConfig } from 'vite';
import { createHtmlPlugin } from 'vite-plugin-html';
import { viteStaticCopy } from 'vite-plugin-static-copy';
// THIS IS A METHOD TO RETURN A JSON WITH ALL THE DEPENDENCIES
import { dependencies } from './package.json';
function renderChunks( deps ) {
let chunks = {};
Object.keys( deps ).forEach( ( key ) => chunks[key] = [ key ] );
return chunks;
}
export default defineConfig( {
root: './example/layer',
base: '', //path to add to output files. For example, base: 'data/' will result in 'data/[name.js]' for entryFileNames
build: {
outDir: './dist',
assetsDir: './dist',
sourcemap: false,
rollupOptions: {
output: {
dir: './dist',
entryFileNames: '[name].js',
assetFileNames: '[name].css',
chunkFileNames: '[name].js',
inlineDynamicImports: false,
manualChunks: renderChunks( dependencies )
}
}
},
plugins: [
createHtmlPlugin( {
minify: true,
entry: 'index.js', //relative to root
template: 'index.html', //relative to root
inject: {
data: {
title: 'index',
injectScript: '<script src="./index.js"></script>',
}
},
} ),
viteStaticCopy( {
targets: [
{
src: '../fonts/helvetiker_regular.typeface.json', //relative to root
dest: '../../../dist/fonts'
}
],
silent: false
} )
]
} );