xxshady/altv-esbuild

Top-level exception with external module when dev: true (altv 14.0)

Closed this issue · 3 comments

Only when "dev: true" I get this error when setting external module :

[Error] [altv-esbuild] Top-level exception:
   ReferenceError: ___altvEsbuild_externalOnTop_node_x__alt_x_altv_x_csharp_x_entity_x_sync_x_to_x_js_x_wrapper___ is not defined
    at altv-esbuild:externals-on-top:alt:altv-csharp-entity-sync-to-js-wrapper (file:///xxxxxxxxx/resources/xear-3d-audio-api/dist/server/index.mjs:84:25)
    at __require (file:///xxxxxxxxxx/resources/xear-3d-audio-api/dist/server/index.mjs:45:50)
    at file:///E:/Dropbox/Game%20Dev/AltV/altv-server-DEV-W/resources/xear-3d-audio-api/dist/server/index.mjs:93:30

My watch-server :

import { build } from "esbuild"
import { altvEsbuild } from "altv-esbuild"

build({
    watch: true,
    bundle: true,
    platform: "node",
    logLevel: "info",
    target: "esnext",
    format: "esm",
    external: ["alt:altv-csharp-entity-sync-to-js-wrapper"],
    entryPoints: ["./resources/xear-3d-audio-api/src/server/index.mjs"],
    outfile: "./resources/xear-3d-audio-api/dist/server/index.mjs",
    plugins: [
        altvEsbuild({
            mode: "server",
            dev: true, // enables hot reload automatically
            altvEnums: false,
        })
    ],
})

In "/server/index.mjs" have :

import alt from 'alt-server'
import * as EntitySyncWrap from 'alt:altv-csharp-entity-sync-to-js-wrapper'

Thanks for the report, I'm looking into reason of this

@xenicle please test and tell me if its fixed for you

published 0.4.7