We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cb90de0 commit 7be6c0cCopy full SHA for 7be6c0c
1 file changed
packages/vite/src/node/server/middlewares/transform.ts
@@ -114,13 +114,17 @@ export function transformMiddleware(
114
}
115
116
117
- // warn explicit /public/ paths
118
- if (url.startsWith('/public/')) {
+ const publicPath =
+ normalizePath(server.config.publicDir).slice(
119
+ server.config.root.length
120
+ ) + '/'
121
+ // warn explicit public paths
122
+ if (url.startsWith(publicPath)) {
123
logger.warn(
124
chalk.yellow(
125
`files in the public directory are served at the root path.\n` +
126
`Instead of ${chalk.cyan(url)}, use ${chalk.cyan(
- url.replace(/^\/public\//, '/')
127
+ url.replace(publicPath, '/')
128
)}.`
129
)
130
0 commit comments