Skip to content

Commit c8cb0a7

Browse files
committed
feat: use from globalThis
1 parent 6c7e79e commit c8cb0a7

File tree

5 files changed

+4
-8
lines changed

5 files changed

+4
-8
lines changed

.nuxtrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
imports.autoImport=true
1+
imports.autoImport=false
22
typescript.includeWorkspace=true

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
"es-module-lexer": "^1.1.0",
5353
"fast-glob": "^3.2.12",
5454
"h3": "^1.0.2",
55-
"ofetch": "^1.0.0",
5655
"pathe": "^1.0.0"
5756
},
5857
"devDependencies": {

pnpm-lock.yaml

+1-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/module.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default defineNuxtModule<ModuleOptions>({
2626
// Transpile runtime and handler
2727
const handlerPath = join(nuxt.options.buildDir, 'remote-event-handler.ts')
2828
const runtimeDir = fileURLToPath(new URL('./runtime', import.meta.url))
29-
nuxt.options.build.transpile.push(runtimeDir)
29+
nuxt.options.build.transpile.push(runtimeDir, handlerPath)
3030

3131
nuxt.hook('builder:watch', async (e, path) => {
3232
if (e === 'change') return

src/runtime/client.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
import { $fetch } from 'ofetch'
2-
31
export function callRemoteFunction <T> (moduleId: string, functionName: string, args: any[]) {
4-
return $fetch<T>(`/api/__remote/${moduleId}/${functionName}`, {
2+
return globalThis.$fetch<T>(`/api/__remote/${moduleId}/${functionName}`, {
53
method: 'POST',
64
body: {
75
args

0 commit comments

Comments
 (0)