artberri / rollup-plugin-istanbul

Seamless integration between Rollup and Istanbul
MIT License
43 stars 10 forks source link

source map not work #21

Closed billowz closed 3 years ago

billowz commented 5 years ago

Expected Behavior

Current Behavior

  1. isbanbul plugin print error on configuring the source map
    TypeError: instrumenter.lastSourceMap(...).toJSON is not a function
    at Object.transform (/test/node_modules/rollup-plugin-istanbul/dist/rollup-plugin-istanbul.cjs.js:30:58)
    at Promise.resolve.then (/test/node_modules/rollup/dist/rollup.js:15344:25)
  2. the souceMap option not work, need to config instrumenterConfig.produceSourceMap

Steps to Reproduce

Context (Environment)

Windows 10, node v10.15.3

Possible Implementation

  1. instrumenter.lastSourceMap returns (null | Object) the source map object.
  2. set instrumenterConfig.produceSourceMap on ops.sourceMap enabled
billowz commented 5 years ago

see rollup/rollup#2983, the istanbul-lib-instrument require the inputSourceMap to maps the not instrumented code back to it's original form

tommck commented 4 years ago

It seems that this was fixed https://github.com/rollup/rollup/pull/2993

Is this support added here yet?

artberri commented 3 years ago

The new version 3.0.0 that I've already published in the npm registry should fix the bug.

Thank you for the report.