Skip to content

Commit cb54075

Browse files
authored
Merge pull request #55 from laravel/vite-components
[0.3.x] Add `app/View/Components/**` to default refresh paths
2 parents f99ce30 + 74c86b9 commit cb54075

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/index.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ interface LaravelPlugin extends Plugin {
8585

8686
let exitHandlersBound = false
8787

88+
export const refreshPaths = [
89+
'app/View/Components/**',
90+
'resources/views/**',
91+
'routes/**',
92+
]
93+
8894
/**
8995
* Laravel plugin for Vite.
9096
*
@@ -99,6 +105,9 @@ export default function laravel(config: string|string[]|PluginConfig): [LaravelP
99105
];
100106
}
101107

108+
/**
109+
* Resolve the Laravel Plugin configuration.
110+
*/
102111
function resolveLaravelPlugin(pluginConfig: Required<PluginConfig>): LaravelPlugin {
103112
let viteDevServerUrl: string
104113
let resolvedConfig: ResolvedConfig
@@ -301,7 +310,7 @@ function resolvePluginConfig(config: string|string[]|PluginConfig): Required<Plu
301310
}
302311

303312
if (config.refresh === true) {
304-
config.refresh = [{ paths: ['resources/views/**', 'routes/**'] }]
313+
config.refresh = [{ paths: refreshPaths }]
305314
}
306315

307316
return {

tests/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ describe('laravel-vite-plugin', () => {
277277
expect(plugins.length).toBe(2)
278278
/** @ts-ignore */
279279
expect(plugins[1].__laravel_plugin_config).toEqual({
280-
paths: ['resources/views/**', 'routes/**'],
280+
paths: ['app/View/Components/**', 'resources/views/**', 'routes/**'],
281281
})
282282
})
283283

0 commit comments

Comments
 (0)