How to handle multiple script roots?
I have a subfolder, in which scripts are without prefix (e.g. main.lua) and all other folders are reachable via package.path (though the debug console says it has mixed / and \ (i'm on win)). If I set sourcemap, either the subfolder or the other "script roots" are found, but I couldn't get both working at the same time.
{
"name": "Launch Debugger 2",
"type": "lua",
"request": "attach",
"address": "127.0.0.1:4278",
"sourceMaps": [
[
"*\\src\\*", // This is in package.path
"${workspaceFolder}/src/*",
],
[
"./*",
"${workspaceFolder}/examples/component_explorer/*",
]
]
},
You can change the chunkname so that they can be distinguished correctly.
How so? The modules are loaded via require(). Do you suggest to create my own require() function? And if so, how should I go about writing it? How is the path inferred from the chunkname? It's not that I haven't written my own require function, I am more interested in how the debugger interprets the chunkname.
Thanks for your feedback :)
If you don't modify require, you shouldn't need to set sourceMaps. The debugger understands chunknames using the rules on the lua documentation.