Skip to content

Commit

Permalink
fix(module): remove prefix for tailwind viewer route on nuxt 2
Browse files Browse the repository at this point in the history
fix bug: #510
  • Loading branch information
chettapong committed Jul 29, 2022
1 parent 5cec9fc commit 96da37c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ export default defineNuxtModule<ModuleOptions>({
const route = '/_tailwind'
const createServer = await import('tailwind-config-viewer/server/index.js').then(r => r.default || r) as any
const { withTrailingSlash, withoutTrailingSlash } = await import('ufo')
const _viewerDevMiddleware = createServer({ tailwindConfigProvider: () => tailwindConfig, routerPrefix: route }).asMiddleware()
const routerPrefix = isNuxt3() ? route : undefined
const _viewerDevMiddleware = createServer({ tailwindConfigProvider: () => tailwindConfig, routerPrefix }).asMiddleware()
const viewerDevMiddleware = (req, res) => {
if (req.originalUrl === withoutTrailingSlash(route)) {
res.writeHead(301, { Location: withTrailingSlash(req.originalUrl) })
Expand Down

0 comments on commit 96da37c

Please sign in to comment.