Skip to content

Commit

Permalink
fix: remove <no source> from sourcemap
Browse files Browse the repository at this point in the history
  • Loading branch information
Anidetrix committed May 2, 2020
1 parent 8385657 commit b1c32e8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/loaders/postcss/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@ const loader: Loader<PostCSSLoaderOptions> = {
for (const asset of assets) this.assets.set(asset.to, asset.source);

map = mm((res.map?.toJSON() as unknown) as RawSourceMap)
.modify(m => {
// Remove "<no source>" if present
const noSource = m.sources?.indexOf("<no source>");
if (noSource === -1) return;
m.sources?.splice(noSource, 1);
m.sourcesContent?.splice(noSource, 1);
})
.resolve(path.dirname(postcssOpts.to))
.toString();

Expand Down

0 comments on commit b1c32e8

Please sign in to comment.