mirror of
https://github.com/nuxt/nuxt.git
synced 2024-12-03 19:07:15 +00:00
a5dad0d2e8
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Daniel Roe <daniel@roe.dev>
15 lines
521 B
JavaScript
15 lines
521 B
JavaScript
// @ts-check
|
|
import { Agent as HTTPSAgent } from 'node:https'
|
|
import { $fetch } from 'ofetch'
|
|
|
|
/** @type {import('../vite-node').ViteNodeServerOptions} */
|
|
export const viteNodeOptions = JSON.parse(process.env.NUXT_VITE_NODE_OPTIONS || '{}')
|
|
|
|
export const viteNodeFetch = $fetch.create({
|
|
baseURL: viteNodeOptions.baseURL,
|
|
// @ts-expect-error https://github.com/node-fetch/node-fetch#custom-agent
|
|
agent: viteNodeOptions.baseURL.startsWith('https://')
|
|
? new HTTPSAgent({ rejectUnauthorized: false })
|
|
: null
|
|
})
|