-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample-reload-config.js
More file actions
67 lines (64 loc) · 1.69 KB
/
example-reload-config.js
File metadata and controls
67 lines (64 loc) · 1.69 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import { defineConfig, consoleLoggerPlugin, scriptInjectionPlugin, styleInjectionPlugin } from './src/index.js';
export default defineConfig({
platforms: {
example: {
name: 'Reload Strategy Example',
url: 'https://example.com',
scripts: [
{
path: './scripts/config.js',
order: 1,
autoInject: true,
reloadOnChange: true, // 🔄 这个脚本修改后会刷新页面
},
{
path: './scripts/init.js',
order: 2,
autoInject: true,
reloadOnChange: true, // 🔄 初始化脚本也需要刷新页面
},
{
path: './scripts/utils.js',
order: 3,
autoInject: true,
// reloadOnChange 默认为 false,所以会热替换
},
{
path: './scripts/ui-components.js',
order: 4,
autoInject: true,
reloadOnChange: false, // 🔥 明确指定热替换
}
],
styles: [
{
path: './styles/reset.css',
order: 1,
autoInject: true,
reloadOnChange: true, // 🔄 重置样式修改后刷新页面
},
{
path: './styles/theme.css',
order: 2,
autoInject: true,
reloadOnChange: true, // 🔄 主题样式修改后刷新页面
},
{
path: './styles/components.css',
order: 3,
autoInject: true,
// 默认热替换,适合组件样式调试
}
]
}
},
plugins: [
consoleLoggerPlugin(),
scriptInjectionPlugin(),
styleInjectionPlugin(),
],
browserOptions: {
headless: false,
devtools: true,
}
});