Sourcemap for child process is not generated.
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 9.8k
- Forks
- 326
- PR merge metrics
- No merged PRs in 30d
Description
When b.js is included by a.js as a file, a path, or a child process. A.js and b.js are built separately.
While Sourcemap for a.js is generated correctly. No sourcemap is generated for b.js.
input
// a.js
console.log('hello from a.js')
const path = require('path')
const bPath = path.resolve(__dirname, './b.js')
// do something with bPath ...
// b.js
console.log('hello from b.js')
npx ncc build ./a.js -o ./dist -s --no-source-map-register
output
- build/index.js
module.exports=(()=>{var e={536:(e,r,_)=>{console.log("hello from a.js");const t=_(622);const a=_.ab+"b.js"},622:e=>{"use strict";e.exports=require("path")}};var r={};function __nccwpck_require__(_){if(r[_]){return r[_].exports}var t=r[_]={exports:{}};var a=true;try{e[_](t,t.exports,__nccwpck_require__);a=false}finally{if(a)delete r[_]}return t.exports}__nccwpck_require__.ab=__dirname+"/";return __nccwpck_require__(536)})();
//# sourceMappingURL=index.js.map
- build/b.js
module.exports=(()=>{var e={463:()=>{console.log("hello from b.js")}};var r={};function __nccwpck_require__(_){if(r[_]){return r[_].exports}var a=r[_]={exports:{}};var o=true;try{e[_](a,a.exports,__nccwpck_require__);o=false}finally{if(o)delete r[_]}return a.exports}__nccwpck_require__.ab=__dirname+"/";return __nccwpck_require__(463)})();
//# sourceMappingURL=b.js.map
- build/index.js.map
{"version":3,"sources":["../webpack:/prj/a.js","../webpack:/prj/external \"path\"","../webpack:/prj/webpack/bootstrap","../webpack:/prj/webpack/runtime/compat","../webpack:/prj/webpack/startup"],"names":["console","log","bPath","__webpack_require__","ab","module","exports","require","__webpack_module_cache__","moduleId","threw","__webpack_modules__","__dirname"],"mappings":"0CAAAA,QAAAC,IAAA,kCAIA,MAAAC,EAAAC,EAAAC,GAAA,6BCJAC,EAAAC,QAAAC,QAAA,UCCA,IAAAC,EAAA,GAGA,SAAAL,oBAAAM,GAEA,GAAAD,EAAAC,GAAA,CACA,OAAAD,EAAAC,GAAAH,QAGA,IAAAD,EAAAG,EAAAC,GAAA,CAGAH,QAAA,IAIA,IAAAI,EAAA,KACA,IACAC,EAAAF,GAAAJ,EAAAA,EAAAC,QAAAH,qBACAO,EAAA,MACA,QACA,GAAAA,SAAAF,EAAAC,GAIA,OAAAJ,EAAAC,QCzBAH,oBAAAC,GAAAQ,UAAA,ICEA,OAAAT,oBAAA","file":"index.js","sourcesContent":[null,"module.exports = require(\"path\");;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\tvar threw = true;\n\ttry {\n\t\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\t\tthrew = false;\n\t} finally {\n\t\tif(threw) delete __webpack_module_cache__[moduleId];\n\t}\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","\n__webpack_require__.ab = __dirname + \"/\";","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(536);\n"]}
Lack of b.js.map. Got same result with -m or not.
version
- macos 11.2.1
- ncc 0.27.0
- node v14.12.0
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the provided a.js and b.js inputs and the npx ncc build command, then inspect the generated build directory and source-map handling. Done means the separately bundled child process produces b.js.map alongside b.js while index.js.map remains correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100