Skip to content

Unable to concatenate file with multiple sourcemaps #181

@mattdsteele

Description

@mattdsteele

I've built a UMD bundle with Webpack 3.0.0, using devtool: '#source-map' as my source map generation option. It ends up producing a build with multiple //# sourceMappingUrl pragmas. For example:

/******/ ([
/* 0 */
/***/ (function(module, exports) {

module.exports = __WEBPACK_EXTERNAL_MODULE_0__;

/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
 /// code
};
//# sourceMappingURL=common.js.map

/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
 /// code
};
//# sourceMappingURL=predicates.js.map

/// etc, to end of file:
//# sourceMappingURL=build.js.map

Only the final build.js.map exists on disk. But this code finds the first sourceMappingUrl and attempts to read it, which results in errors such as:

Warning: Unable to read "C:\code\node_modules\sample\common.js.map" file (Error code: ENOENT). Use --force to continue.

I'm not familiar enough with the source map spec to know how to resolve this, but other tools (gulp, Chrome) seem to read this file fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions