Skip to content

Commit 2932bad

Browse files
chettapongatinux
andauthoredAug 12, 2022
fix(module): remove prefix for tailwind viewer route on nuxt 2 (#517)
Co-authored-by: Sébastien Chopin <seb@nuxtjs.com>
1 parent 82ea9b7 commit 2932bad

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

‎src/module.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,8 @@ export default defineNuxtModule<ModuleOptions>({
226226
const route = '/_tailwind'
227227
const createServer = await import('tailwind-config-viewer/server/index.js').then(r => r.default || r) as any
228228
const { withTrailingSlash, withoutTrailingSlash } = await import('ufo')
229-
const _viewerDevMiddleware = createServer({ tailwindConfigProvider: () => tailwindConfig, routerPrefix: route }).asMiddleware()
229+
const routerPrefix = isNuxt3() ? route : undefined
230+
const _viewerDevMiddleware = createServer({ tailwindConfigProvider: () => tailwindConfig, routerPrefix }).asMiddleware()
230231
const viewerDevMiddleware = (req, res) => {
231232
if (req.originalUrl === withoutTrailingSlash(route)) {
232233
res.writeHead(301, { Location: withTrailingSlash(req.originalUrl) })

0 commit comments

Comments
 (0)
Please sign in to comment.