FormidableLabs / inspectpack

An inspection tool for Webpack frontend JavaScript bundles.
MIT License
592 stars 20 forks source link

Running with bundles made with and using DLLPlugin do not process properly #36

Closed Trakkasure closed 6 years ago

Trakkasure commented 7 years ago

Part of the problem is that the expected file match isn't correct. DLL plugin uses code like this to refer to external resources:

/* 0 */
/*!****************************************************************************!*\
  !*** delegated ./node_modules/react/react.js from dll-reference react_lib ***!
  \****************************************************************************/
/*! no static exports found */
/*! all exports used */
/***/ (function(module, exports, __webpack_require__) {

module.exports = (__webpack_require__(15))(6);

/***/ }),

These changes fix that parsing Add in parser/index.js line 41:

    if (!fileName) 
      return console.log("No file name for ",moduleId);

Replace extractPath function parser/extractors.js:


// Extracts the path from this string format:
// !*** ../foo/awesomez.js ***!
const extractPath = function (pathInfoComment) {
    if (!pathInfoComment) return null;
  return pathInfoComment.match(/!\*{3}\s(?:delegated )?([^\s]+)/)[1];
};
ryan-roemer commented 7 years ago

Can you give me the CLI command you're running?

Also, can you describe the issue in terms of if this is throwing an Error (with a stack trace please?) or giving you results different from what you expect?

Thanks!

ryan-roemer commented 6 years ago

Should be obviated in inspectpack@^3 because we use stats object now, not real bundles.