What happened?
RegisterResourceBuildTaskFactory clearly exists to let resources run build steps (transpile, bundle, generate files, etc.). but in practice, you can't really use it because the sandbox blocks fs.write and similar by default, so you end up in this situation:
- api is there for building stuff
- building stuff needs file writes
- sandbox blocks file writes
and so the api its just useless
Error you get:
Filesystem write permission check from 'X' for permission fs.write on resource '.../build/...' - write not allowed
Error: Access to this API has been restricted. Use --allow-fs-write to manage permissions.
the error tells you to use --allow-fs-write, but there's basically no documentation on how to actually use it
Another weird part:
there's already some cheats/workarounds in the runtime for tools like webpack/yarn:
|
if (m_resourceName == "yarn" || m_resourceName == "webpack") |
so some tools get exceptions/special treatment
What would make more sense:
allow fs.write and similar when using build tasks or expose a way to enable write access globally
Expected result
RegisterResourceBuildTaskFactory should be usable out of the box for its intended purpose
Reproduction steps
- Create a basic resource and register a build task using RegisterResourceBuildTaskFactory
- Inside the build task, attempt to write a file to the resource folder (e.g. using fs.writeFileSync)
- Start the resource normally
- Start another resource using the build task and observe the error in the console
Importancy
Unknown
Area(s)
FXServer
Specific version(s)
FXServer-master SERVER v1.0.0.28009 win32
Additional information
No response
What happened?
RegisterResourceBuildTaskFactoryclearly exists to let resources run build steps (transpile, bundle, generate files, etc.). but in practice, you can't really use it because the sandbox blocksfs.writeand similar by default, so you end up in this situation:and so the api its just useless
Error you get:
the error tells you to use
--allow-fs-write, but there's basically no documentation on how to actually use itAnother weird part:
there's already some cheats/workarounds in the runtime for tools like webpack/yarn:
fivem/code/components/citizen-scripting-node/src/NodeScriptRuntime.cpp
Line 116 in 2f3d20c
so some tools get exceptions/special treatment
What would make more sense:
allow fs.write and similar when using build tasks or expose a way to enable write access globally
Expected result
RegisterResourceBuildTaskFactory should be usable out of the box for its intended purpose
Reproduction steps
Importancy
Unknown
Area(s)
FXServer
Specific version(s)
FXServer-master SERVER v1.0.0.28009 win32
Additional information
No response