Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support: use server export (JS) in custom app #1143

Open
postb99 opened this issue Mar 19, 2024 · 0 comments
Open

Support: use server export (JS) in custom app #1143

postb99 opened this issue Mar 19, 2024 · 0 comments
Labels
New Issue New Issue to the repo.

Comments

@postb99
Copy link

postb99 commented Mar 19, 2024

Development Issue

Unsure

Phone Version

master

Issue Description

I started rewriting an npwd's working app server.lua to server.ts. I don't know what I miss to be able to use onMessage export (see https://projecterror.dev/docs/npwd/api/server-exports/ the Lua and JS code are almost the same).

I also read the FAQ (https://projecterror.dev/docs/npwd/faq/#errors) and have useResourceIntegration set to true.

As on the server-exports page I don't have much code, but when I hit F12 on "exports" (in VS Code) it browses to @citizenfx/server so what do I miss to install or configure?

import { oxmysql as MySQL } from '@overextended/oxmysql';
import { OnMessageExportCtx } from '@npwd/types';
const ESX  = exports['es_extended'].getSharedObject();

console.log('Server started.');

exports.npwd.onMessage(value.num, (ctx: OnMessageExportCtx) => {
        console.log(ctx);
}));

Thanks a lot.

Issue Reproduction

  1. Setup sample app from template
  2. Install "@npwd/types" package (npm install --save-dev)
  3. update server.ts code as described
  4. compile my app
  5. run FxServer that loads the app and logs Error: No such export onMessage in resource npwd

Evidence

No response

@postb99 postb99 added the New Issue New Issue to the repo. label Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New Issue New Issue to the repo.
Projects
None yet
Development

No branches or pull requests

1 participant