Skip to content

Commit 578d5cc

Browse files
feat: fetch remote resources
1 parent 158cd47 commit 578d5cc

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

src/utils.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ async function flattenSourceMap(map) {
6060
},
6161
};
6262

63-
if (source) {
64-
generatedMap.addMapping(mappings);
65-
}
63+
generatedMap.addMapping(mappings);
6664
});
6765

6866
return generatedMap.toJSON();

test/__snapshots__/loader.test.js.snap

+2
Original file line numberDiff line numberDiff line change
@@ -485,10 +485,12 @@ exports[`source-map-loader should support file protocol path: map 1`] = `
485485
Object {
486486
"mappings": "CAAC,IAAI,IAAM,SAAUA,GAClB,OAAOA",
487487
"sources": Array [
488+
"/test/fixtures/normal-file.js - (normalized for test)",
488489
"/test/fixtures/normal-file.js - (normalized for test)",
489490
"/test/fixtures/normal-file2.js - (normalized for test)",
490491
],
491492
"sourcesContent": Array [
493+
"static content",
492494
"without SourceMap",
493495
"// without SourceMap
494496
anInvalidDirective = \\"\\\\n/*# sourceMappingURL=data:application/json;base64,\\"+btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))))+\\" */\\";

test/loader.test.js

+4
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,15 @@ describe('source-map-loader', () => {
200200
const rawSourceMap = {
201201
version: 3,
202202
sources: [
203+
`file://${path
204+
.resolve(__dirname, 'fixtures', 'normal-file.js')
205+
.replace(/\\/g, '/')}`,
203206
'normal-file.js',
204207
`file://${path
205208
.resolve(__dirname, 'fixtures', 'normal-file2.js')
206209
.replace(/\\/g, '/')}`,
207210
],
211+
sourcesContent: ['static content'],
208212
mappings: 'CAAC,IAAI,IAAM,SAAUA,GAClB,OAAOA',
209213
};
210214
fs.writeFileSync(sourceMapPath, JSON.stringify(rawSourceMap));

0 commit comments

Comments
 (0)