-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.js
41 lines (34 loc) · 1.69 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
// https://stackblitz.com/edit/vitejs-vite-vtb3nk?file=vite.config.js&terminal=dev
// inspired by
// https://github.com/fgeierst/typo3-vite-demo/blob/master/packages/typo3_vite_demo/Resources/Private/JavaScript/vite.config.js
import { defineConfig } from 'vite'
import { svelte } from '@sveltejs/vite-plugin-svelte'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [svelte()],
// root: path.resolve(__dirname, 'src/js'),
server: {
host: "0.0.0.0", // leave this unchanged for DDEV!
port: 5173,
origin: 'https://ddev-wp-acf-blocks-svelte.ddev.site'
},
publicDir: false, // disable copy `public/` to outDir
build: {
// generate manifest.json in outDir
manifest: true,
rollupOptions: {
input: 'wp-content/themes/raft-child/main.js'
/* Single files approach
input: {
'svelte-demo-block': 'wp-content/themes/raft-child/blocks/svelte-demo-block/main.js',
'svelte-demo-block': 'wp-content/themes/raft-child/blocks/svelte-demo-block/main.js',
},*/
// It is also possible to split it into multiple js files, see: https://rollupjs.org/guide/en/#input
// But then we need to be careful with dev includes path (<script type="module" src="<?php echo get_site_url(); ?>:5173/wp-content/themes/raft-child/blocks/svelte-demo-block/main.js"></script>) and path for production builds: src="<?php echo get_site_url(); ?>/wp-content/themes/raft-child/dist/entry-svelte-demo-block.js"
/* output: {
entryFileNames: 'entry-[name].js'
}*/
},
outDir: 'wp-content/themes/raft-child/dist',
}
})