Skip to content

[Feature] Allow custom NODE_PATH for javascript scripts #569

Open
@estacioneto

Description

@estacioneto

Context

I currently have a project with the following structure:

project/
├── package.json
├── node_modules/...
├── src/...
├── scripts/... # General project scripts
└── http/
    ├── http-client.env.json
    ├── endpoints.http
    └── scripts/
        └── pre-request.js

For me to use dependencies on project/node_modules, I'd need to move the pre-request.js to the root of the project, but it would mess with the project's structure. It would be perfect to either set the node_modules path or to try to resolve the dependency location before generating the script that will run.

Possible solutions

There are multiple solutions, but I think the quick-win would be a way to change the NODE_PATH passed on lua/kulala/parser/scripts/engines/javascript/init.lua when calling the script (through a node_path_resolver function on the plugin's config maybe?).

Ideally, resolving the dependency automatically would be perfect, but I'm not sure about the effort here.

Do you think this is possible? What path would be preferrable?

Thanks in advance and thanks again for the awesome plugin :)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions