How to Decouple Module Dependency

  node.js, question

I am designing a file information management module for a project.

There are now two documents, as follows

index.js

const fs = require('fs');
 const Manga = require('./manga');
 
 let cache = [];  //An array for storing comics
 
 //read configuration file
 let init = () => {
 //pseudocode, don't care ...
 fs.readFile('./config.json').then(fileContent => {
 fileContent.forEach(opt => {
 cache.push(new Manga(opt));
 });
 });
 bracket
 
 //Save Configuration File
 let save = () => {
 fs.writeFile('./config.json', cache);
 bracket
 
 module.exports = {
 init,
 save
 bracket

manga.js

const save = require('./index').save;
 
 class Manga {
 constructor(opt) {
 this.data = opt;
 bracket
 
 set(key, val) {
 this.data[key] = val;
 save();  //The problem arises here.
 return this;
 bracket
 bracket
 
 module.exports = Manga;

As you can see, there is a dependency cycle between these two files.

And I think, every callManga.set, it can be saved automatically instead of being called manually from outside.save.

In addition to merging these two documents into one, how should we design them to avoid this kind of situation?

Save and cache are presented separately.