Skip to content

require it is normal or not? #3404

@alexander-akait

Description

@alexander-akait
for (var i = 0; i < 10; i++) {
    var jsonObject = require('file.json');

    functionChangeJsonObject(jsonObject);
}

First call require load file from filesystem, second call get this file from cache (reference on object). But my function(s) may be change this object. And second call require return changed object. It is normal behavior or not?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionIssues that look for answers.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions