fix: polyfill $fetch on globalThis

TODO: nitro client plugin needs rewrite
This commit is contained in:
Pooya Parsa 2021-02-19 14:59:47 +01:00
parent bece3b85ab
commit a1ac066cb5

View File

@ -1,9 +1,12 @@
import '@nuxt/nitro/dist/runtime/app/nitro.client' import { $fetch } from 'ohmyfetch'
import _global from '@nuxt/un/runtime/global'
import logs from 'nuxt/app/plugins/logs.client.dev' import logs from 'nuxt/app/plugins/logs.client.dev'
import progress from 'nuxt/app/plugins/progress.client' import progress from 'nuxt/app/plugins/progress.client'
<% const plugins = app.plugins.filter(p => p.mode === 'client').map(p => p.src) %> <% const plugins = app.plugins.filter(p => p.mode === 'client').map(p => p.src) %>
<%= nxt.importSources(plugins) %> <%= nxt.importSources(plugins) %>
_global.$fetch = $fetch
const plugins = [ const plugins = [
progress, progress,
<%= plugins.map(nxt.importName).join(',\n\t') %> <%= plugins.map(nxt.importName).join(',\n\t') %>