Skip to content

Cannot find dependencies of library built with parcel #4742

Answered by mischnic
tillsanders asked this question in General
Discussion options

You must be logged in to vote

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 require("lodash") should include the lodash package b…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@tillsanders
Comment options

@mischnic
Comment options

Answer selected by mischnic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants