mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-29 17:07:22 +00:00
15 lines
522 B
JavaScript
15 lines
522 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,
|
|
})
|