Skip to content

Commit 1501f5c

Browse files
[1.x] Fix Invalid URL issue with Vite 6.0.9 (#317)
* [1.x] Fix Invalid URL issue with Vite 6.0.9 This PR resolves the "Invalid URL" error that occurred due to the requirement that the server.origin value be a URL, introduced in the recently released Vite 6.0.9. * Update placeholder url * Replace the correct placeholder --------- Co-authored-by: Tim MacDonald <hello@timacdonald.me>
1 parent e57a940 commit 1501f5c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ function resolveLaravelPlugin(pluginConfig: Required<PluginConfig>): LaravelPlug
151151
assetsInlineLimit: userConfig.build?.assetsInlineLimit ?? 0,
152152
},
153153
server: {
154-
origin: userConfig.server?.origin ?? '__laravel_vite_placeholder__',
154+
origin: userConfig.server?.origin ?? 'http://__laravel_vite_placeholder__.test',
155155
...(process.env.LARAVEL_SAIL ? {
156156
host: userConfig.server?.host ?? '0.0.0.0',
157157
port: userConfig.server?.port ?? (env.VITE_PORT ? parseInt(env.VITE_PORT) : 5173),
@@ -190,7 +190,7 @@ function resolveLaravelPlugin(pluginConfig: Required<PluginConfig>): LaravelPlug
190190
},
191191
transform(code) {
192192
if (resolvedConfig.command === 'serve') {
193-
code = code.replace(/__laravel_vite_placeholder__/g, viteDevServerUrl)
193+
code = code.replace(/http:\/\/__laravel_vite_placeholder__\.test/g, viteDevServerUrl)
194194

195195
return pluginConfig.transformOnServe(code, viteDevServerUrl)
196196
}

0 commit comments

Comments
 (0)