TypeScript module params like GO idFlags

Hi. Nakama 3.9.0, typescript. Maybe anyone know how to pass param to typescript module like idFlags in go modules?
For example I want to read package.json file and pass the values to the TS module.

Any ideas? Just pass any vars to JS module like go idFlags :frowning:

I’m unfamiliar with idFlags - can you point me to some resources that explain what it is? Maybe a GitHub repo or documentation?

-ldflags “-s -w -X main.version=$version -X main.commitID=$commit”

You cannot pass command line arguments to the TS virtual machine. Instead you should use the runtime env variable to pass info through;

So I should use YAML config for this?

I solved this using ‘@rollup/plugin-replace’ plugin:

rollup.config.js

import replace from '@rollup/plugin-replace';
import pkg from '../package.json';

...
  plugins: [
      replace({
        __SERVER_VERSION__: JSON.stringify(pkg.version)
      })
  ]
...

index.d.ts

declare const __SERVER_VERSION__;

main.ts

logger.info('Server version ' + __SERVER_VERSION__)

Thanks