Skip to content

Commit

Permalink
Refactor to allow for custom host (#481)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shalashtein authored Mar 18, 2024
1 parent 5a7d614 commit 48f06d3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/storybook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import { logger } from '@nuxt/kit'

export async function setupStorybook(options: any, nuxt: Nuxt) {
const STORYBOOK_ROUTE = options.storybookRoute || '/__storybook_route'
const STORYBOOK_PORT = await getPort({ ports: [options.port || 6006 , 6007, 6008, 6009, 6010]})
const STORYBOOK_URL = 'http://localhost:'+ STORYBOOK_PORT
const STORYBOOK_PORT = await getPort({ ports: [options.port || 6006, 6007, 6008, 6009, 6010]})
const STORYBOOK_HOST = options.storybookHost || 'http://localhost'
const STORYBOOK_URL = + STORYBOOK_HOST + STORYBOOK_PORT == 80 ? '' : `:${STORYBOOK_PORT}`

const projectDir = resolve(nuxt.options.rootDir)
const args = isStorybookConfigured(projectDir) ?
Expand Down Expand Up @@ -53,7 +54,7 @@ export async function setupStorybook(options: any, nuxt: Nuxt) {
} )

const storybookProxy = {
target: `http://localhost:${STORYBOOK_PORT}`,
target: STORYBOOK_URL,
changeOrigin: true,
followRedirects: true,
secure: false,
Expand Down

0 comments on commit 48f06d3

Please sign in to comment.