Cannot find dependencies of library built with parcel #4742
-
I author a library that runs in the browser. It is, however, part of a bigger application. Therefore I build it with I'm using the latest parcel v1. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
The problem is that the output of Parcel 1 always looked like this: (function (modulesMap, entry) {
// internal runtime
})(
{
"index.js": function (require, module, exports) {
// contents of `src/index.js`
var Foo = require("./thing.js");
var obj = new Foo();
obj.run();
},
"thing.js": function (require, module, exports) {
// contents of `src/thing.js`
var lodash = require("lodash");
module.exports = class Foo {
run() {
console.log(lodash.add(1, 2));
}
};
},
},
"index.js"
); But if you try to run Parcel over this again, it cannot infer that Bundles generated by Parcel 2 don't have this problem (because the individual file contents aren't grouped into functions but concatenated together via scope-hoisting). |
Beta Was this translation helpful? Give feedback.
The problem is that the output of Parcel 1 always looked like this:
But if you try to run Parcel over this again, it cannot infer that
require("lodash")
should include the lodash package b…