istanbuljs / babel-plugin-istanbul

A babel plugin that adds istanbul instrumentation to ES6 code
BSD 3-Clause "New" or "Revised" License
616 stars 72 forks source link

Generate inputSourceMap for all files #253

Open ElphieChang opened 4 years ago

ElphieChang commented 4 years ago

I found that not all files could be added inputSourcemap in window.coverage when using babel-plugin-istanbul. Sucn files like vue files or ts files which are loaded by vue-loader or ts-loader, can get inputSourceMap,because before they got processed by babel-plugin-istanbul, they have got inputmap in those loaders (vue-loader or ts-loader). And in the code of istanbul, this is how the inputSourceMap is processed:

if (this.opts.useInlineSourceMaps !== false) {
      if (!inputSourceMap && this.file.inputMap) {
            inputSourceMap = this.file.inputMap.sourcemap;
      }
 }

I want to generate inputSourceMap for all files, and know how to process it.If this idea is agreed, I will push a MR

jimwong666 commented 6 months ago

you can adjust loader order, or use @babel/generator generate sourcemap