forked from james0r/slayed
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
51 lines (46 loc) · 1.11 KB
/
vite.config.js
File metadata and controls
51 lines (46 loc) · 1.11 KB
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
import shopify from 'vite-plugin-shopify'
import basicSsl from '@vitejs/plugin-basic-ssl'
import { watch } from 'chokidar';
import fs from 'fs-extra'
const watchStaticAssets = () => ({
name: 'watch-static-assets',
configureServer(server) {
const watcher = watch('./public/*', {
persistent: true
});
const copyAsset = async path => {
await fs.copy(path, `assets/${path.replace('public/', '')}`);
}
const removeAsset = async path => {
await fs.remove(`assets/${path.replace('public/', '')}`);
}
watcher.on('add', copyAsset);
watcher.on('change', copyAsset);
watcher.on('unlink', removeAsset);
}
})
export default {
clearScreen: false,
server: {
host: '127.0.0.1',
https: true,
port: 3000
},
publicDir: true,
plugins: [
basicSsl(),
watchStaticAssets(),
shopify()
],
build: {
manifest: 'manifest.json',
sourcemap: true,
rollupOptions: {
output: {
entryFileNames: '[name].[hash].min.js',
chunkFileNames: '[name].[hash].min.js',
assetFileNames: '[name].[hash].min[extname]',
},
}
}
}