AmyrAhmady / samp-node

a SA-MP plugin to run nodejs scripts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"node_flags" causes the script not to load

erfanasbari opened this issue · comments

commented

I'm using typescript and tried using this flag: -r tsconfig-paths/register and the script didn't load. I thought to my self maybe it doesn't support something like this but when I tried some other flags like --no-warnings or --jitless or even an empty string I get the same result. When I don't use any flags it works without any problem.

This is my samp-node.json:

{
	"log_level": 4,
	"enable_resources": false,
	"entry_file": "src/js/index.js",
	"node_flags": ["-r tsconfig-paths/register"]
}

And this is the samp-node.log:

[17/07/2021 - 11:54:17] -> [PLUGIN] samp-node plugin started...
[17/07/2021 - 11:54:17] -> [DEBUG]: node flags: node
[17/07/2021 - 11:54:17] -> [DEBUG]: node flags: -r tsconfig-paths/register
[17/07/2021 - 11:54:17] -> [DEBUG]: node flags: src/js/index.js
commented

Hi there
right now to be able to use TypeScript you have to run "tsc" in your project's directory and set entry file path to your final transpiled JavaScript file, so this way you don't need to pass any extra flags to node environment as well

commented

Hi @AmyrAhmady

I'm aware of how to use typescript 😂 (I use it every day)
If you take a look at samp-node.json, entry file is src/js/index.js (transpiled js file)
The flag I'm using is to convert import paths using tsconfig-path package, not to compile ts to js. (doesn't matter what flag I'm using)

The main issue is not what I want to do with ts or js, It's node_flags causing the script not to load. (I tried multiple node flags), even an empty string causes the script not to load.

commented

@erfanasbari is it possible for you to test it again now with new version out?