-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
46 lines (45 loc) · 1.19 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
/** @type {import('vite').UserConfig} */
import StringReplace from "vite-plugin-string-replace";
import { viteStaticCopy } from "vite-plugin-static-copy";
export default {
build: {
rollupOptions: {
output: {
assetFileNames: (assetInfo) => {
if (assetInfo.name == "index.css") return "styles.css";
return assetInfo.name;
},
},
},
},
plugins: [
viteStaticCopy({
targets: [
{
src: [
"*.js",
"*.html",
],
dest: "./",
},
],
}),
StringReplace([
{
fileName: "index.html",
search: /="\/assets\//g, // you can use RegEXP to search in content
replace: '="assets/', // replace search string with this
},
{
fileName: "index.html",
search: '<script src="', // you can use RegEXP to search in content
replace: '<script src="Scripts/', // replace search string with this
},
{
fileName: "index.html",
search: 'href="/styles.css"', // you can use RegEXP to search in content
replace: 'href="Content\\styles.css"', // replace search string with this
},
]),
],
};