browserify-incremental
browserify-incremental copied to clipboard
Exposed module requiring other exposed module results in error when using cache
For a minimal example, put in file a.js:
module.exports = 'hi';
And in file b.js:
module.exports = require('a');
And compile with browserifyinc --require ./a.js:a --require ./b.js:b. The first time this works fine; the second (after filling the cache) it results in Error: ENOENT, open 'a'. This is because the cache contains
"deps": {
"a": "a"
}
We should not try to open that, since it is a module name and not a file path.
- Note: The
module.exportssetting is irrelevant, but useful if you want to see that this is a meaningful thing to do. In filec.js:
console.log(require('a'))
console.log(require('b'))
And then compile with browserifyinc --external a --external b c.js. When run after the first bundle, this will print 'hi' twice.
This might actually be a browserify issue. I've submitted a PR there, so we'll see.
I've opened a ticket on browserify-cache-api that might be related to this: https://github.com/jsdf/browserify-cache-api/issues/10