-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathvite.config.js
52 lines (51 loc) · 1.2 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
import { defineConfig } from 'vite'
import copy from 'rollup-plugin-copy'
import shopify from 'vite-plugin-shopify'
import shopifyModules from 'vite-plugin-shopify-modules'
import cleanup from '@by-association-only/vite-plugin-shopify-clean'
import dynamicImport from 'vite-plugin-dynamic-import'
import babel from 'vite-plugin-babel';
export default defineConfig({
build: {
emptyOutDir: false,
rollupOptions: {
output: {
entryFileNames: `[name].[hash].js`,
chunkFileNames: `[name].[hash].js`,
assetFileNames: `[name].[hash].[ext]`
}
},
sourcemap: false
},
resolve: {
alias: {
'react': 'preact-compat',
'react-dom': 'preact-compat'
}
},
publicDir: 'public',
plugins: [
babel(),
dynamicImport(),
/**
* Copy plain static assets to the root of the dist directory as-is.
* - During build, vite knows how to handle it
* - During dev, use rollup-plugin-copy
*/
copy({
targets: [
{
src: 'public/*',
dest: 'assets'
}
],
flatten: true,
hook: 'buildStart'
}),
cleanup(),
shopify(),
shopifyModules({
modulesDir: 'modules'
})
]
})