Skip to content

Commit

Permalink
fix: sourcemap generating when previous loader pass sourcemap as stri…
Browse files Browse the repository at this point in the history
…ng (#905)
  • Loading branch information
evilebottnawi authored Mar 6, 2019
1 parent cc81af1 commit 3797e4d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ export default function loader(content, map, meta) {
if (sourceMap) {
if (map) {
// Some loader emit source map as string
// Strip any JSON XSSI avoidance prefix from the string (as documented in the source maps specification), and then parse the string as JSON.
if (typeof map === 'string') {
map = JSON.stringify(map);
map = JSON.parse(map.replace(/^\)]}'[^\n]*\n/, ''));
}

// Source maps should use forward slash because it is URLs (https://github.com/mozilla/source-map/issues/91)
Expand Down

0 comments on commit 3797e4d

Please sign in to comment.