Use case persistify + circular json
July 25, 2016 ยท View on GitHub
See https://github.com/royriojas/flat-cache/issues/5
To demonstrate the issue:
Run npm run bundle-watch (or persistify ./index.js --cache-dir ./cache --watch -o bundle.js)
Leads to:
TypeError: Converting circular structure to JSON
Reasons:
- The issue appear when a
foopackage use abrowserify.transformfield in thepackage.jsonfile (with an options object)(...) "browserify": { "transform": [ [ "./transform", { } ] ] } - The options object will be populated with a circular reference to the main browserify
packageCacheobject when used with watchify (hence the--watchoption)# with `var cache` the persistify cache: cache.persistifyArgs.packageCache['<absolute path to>/foo/package.json'].browserify.transform[0][1]._flags.packageCache === cache.persistifyArgs.packageCache