Skip to content

Commit e53942c

Browse files
committed
remove dot-path-fix vite plugin while we're not using it
1 parent 1af82bf commit e53942c

File tree

1 file changed

+1
-36
lines changed

1 file changed

+1
-36
lines changed

vite.config.ts

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import { resolve } from 'path'
99
import basicSsl from '@vitejs/plugin-basic-ssl'
1010
import react from '@vitejs/plugin-react-swc'
11-
import { defineConfig, type Plugin } from 'vite'
11+
import { defineConfig } from 'vite'
1212
import { createHtmlPlugin } from 'vite-plugin-html'
1313
import tsconfigPaths from 'vite-tsconfig-paths'
1414
import { z } from 'zod'
@@ -33,9 +33,6 @@ const apiMode = apiModeResult.data
3333
// if you want a different host you can override it with EXT_HOST
3434
const DOGFOOD_HOST = process.env.EXT_HOST || 'oxide.sys.rack2.eng.oxide.computer'
3535

36-
/** Match a semver string like 1.0.0-abc */
37-
const semverRegex = '\\d+\\.\\d+\\.\\d+([\\-\\+].+)?'
38-
3936
const previewAnalyticsTag = {
4037
injectTo: 'head' as const,
4138
tag: 'script',
@@ -100,7 +97,6 @@ export default defineConfig(({ mode }) => ({
10097
},
10198
}),
10299
react(),
103-
dotPathFixPlugin([new RegExp('^/system/update/updates/' + semverRegex)]),
104100
apiMode === 'dogfood' && basicSsl(),
105101
],
106102
server: {
@@ -129,34 +125,3 @@ export default defineConfig(({ mode }) => ({
129125
includeSource: ['app/**/*.ts'],
130126
},
131127
}))
132-
133-
/**
134-
* Configure a safelist of path patterns that can be redirected to `/` despite
135-
* having a dot in them.
136-
*
137-
* Vite does not rewrite paths with dots in them to serve `/index.html`, likely
138-
* because it wants to assume they are static files that should be served
139-
* directly. See https://github.com/vitejs/vite/issues/2415.
140-
*
141-
* We have a few non-file console paths that we expect to contain a dot. Names
142-
* cannot contain dots, but semver versions always will. So we safelist some
143-
* paths that we expect to have dots so they will work in the dev server.
144-
*
145-
* If a path needs to be added to this safelist, it will show up as a blank page
146-
* in local dev and the Vite `--debug` output will say:
147-
*
148-
* "Not rewriting GET /has.dot because the path includes a dot (.) character."
149-
*/
150-
function dotPathFixPlugin(safeDotPaths: RegExp[]): Plugin {
151-
return {
152-
name: 'dot-path-fix',
153-
configureServer: (server) => {
154-
server.middlewares.use((req, _, next) => {
155-
if (req.url && safeDotPaths.some((p) => req.url?.match(p))) {
156-
req.url = '/'
157-
}
158-
next()
159-
})
160-
},
161-
}
162-
}

0 commit comments

Comments
 (0)