Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
jessarcher committed Jul 4, 2022
1 parent 94d14a7 commit 18b7fb3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
1 change: 1 addition & 0 deletions src/dev-server-index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&display=swap" rel="stylesheet">

<!-- Styles -->
<style>
body {
font-family: 'Nunito', sans-serif;
Expand Down
28 changes: 13 additions & 15 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,25 +204,23 @@ function resolveLaravelPlugin(pluginConfig: Required<PluginConfig>): LaravelPlug

exitHandlersBound = true

return () => {
server.middlewares.use((req, res, next) => {
if (req.url === '/index.html') {
server.config.logger.warn(
"\n" + colors.bgYellow(
colors.black(`The Vite server should not be accessed directly. Your Laravel application's configured APP_URL is: ${appUrl}`)
)
return () => server.middlewares.use((req, res, next) => {
if (req.url === '/index.html') {
server.config.logger.warn(
"\n" + colors.bgYellow(
colors.black(`The Vite server should not be accessed directly. Your Laravel application's configured APP_URL is: ${appUrl}`)
)
)

res.statusCode = 404
res.statusCode = 404

res.end(
fs.readFileSync(path.join(__dirname, 'dev-server-index.html')).toString().replace(/{{ APP_URL }}/g, appUrl)
)
}
res.end(
fs.readFileSync(path.join(__dirname, 'dev-server-index.html')).toString().replace(/{{ APP_URL }}/g, appUrl)
)
}

next()
});
}
next()
})
},

// The following two hooks are a workaround to help solve a "flash of unstyled content" with Blade.
Expand Down

0 comments on commit 18b7fb3

Please sign in to comment.