Skip to content

Commit 5ce2156

Browse files
Seth FearnsideSeth Fearnside
authored andcommitted
Assigned shifted mappings to script Source Map
1 parent be291e6 commit 5ce2156

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

vue.config.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ module.exports = {
2323
sourceMaps[pathWithoutQuery] = module['_source']['_sourceMap'];
2424
});
2525

26-
2726
compilation.hooks.finishModules.tapPromise('All Modules Built', async (modules) => {
2827
for (const module of modules) {
2928
const { resource } = module;
@@ -49,8 +48,8 @@ module.exports = {
4948
let indexOfScriptTag = 0;
5049

5150
for (const line of lines) {
52-
if (/<script/.test(line)) break;
5351
++indexOfScriptTag;
52+
if (/<script/.test(line)) break;
5453
}
5554

5655
const shiftedSourceMap = await SourceMapConsumer.with(scriptSourceMap, null, async (consumer) => {
@@ -74,7 +73,7 @@ module.exports = {
7473
else {
7574
original = {
7675
column: originalColumn,
77-
line: originalLine + indexOfScriptTag - 1,
76+
line: originalLine + indexOfScriptTag,
7877
};
7978
}
8079

@@ -91,11 +90,13 @@ module.exports = {
9190

9291
return generator.toJSON();
9392
});
93+
94+
scriptSourceMap.mappings = shiftedSourceMap.mappings;
9495
}
9596
});
9697
});
9798
}
9899
}]
99100
};
100101
}
101-
};
102+
};

0 commit comments

Comments
 (0)