Skip to content

Does not work with relative paths in sub-directories #23

@drywolf

Description

@drywolf

Hi,

I wanted to replace some of my require('./config.json') usages in my project with cjson.load('./config.json'). The config.json file is located in a sub-directory structure of my project, and alongside it there is a .js file that tries to require/load it.

But it turns out that cjson tries to resolve the relative path starting from the root of the project, not the current directory of the .js file. Is this algorithm for resolving relative paths by design for cjson, or is it supposed to work the same way as the default node.js require() algorithm ? (which I would have expected)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions