sarsamurmu / reboost

A super fast dev server for rapid web development
MIT License
61 stars 3 forks source link

"plugin-babel - transformContent" mismatch type declaration #34

Closed GHNewbiee closed 4 years ago

GHNewbiee commented 4 years ago

In reboost/packages/plugin-babel/src/index.ts, transformContent function gives an error. See photo below.

Screenshot_1

Note : In fact, I am trying to write a new plugin for which I follow the pattern of the above-mentioned plugin.

sarsamurmu commented 4 years ago

The returned map should be a RawSourceMap object, but in your case it's string. So you've to do it like this

const result = await swc.transform(...);
const code = result.code;
const map = JSON.parse(result.map);
// Do other things..

return { code, map }
GHNewbiee commented 4 years ago

Sorry, total hasty negligence of mine.