Test and fix export statement sourcemap
This commit is contained in:
parent
108838c66c
commit
46ebd90acb
@ -184,7 +184,9 @@ export default function () {
|
||||
|
||||
// Copy location from the original import statement for sourcemap
|
||||
// generation.
|
||||
varDecl.loc = imports[source].loc;
|
||||
if (imports[source]) {
|
||||
varDecl.loc = imports[source].loc;
|
||||
}
|
||||
|
||||
if (typeof blockHoist === "number" && blockHoist > 0) {
|
||||
varDecl._blockHoist = blockHoist;
|
||||
@ -338,9 +340,11 @@ export default function () {
|
||||
path.replaceWithMultiple(nodes);
|
||||
}
|
||||
} else if (path.isExportAllDeclaration()) {
|
||||
topNodes.push(buildExportAll({
|
||||
let exportNode = buildExportAll({
|
||||
OBJECT: addRequire(path.node.source.value, path.node._blockHoist)
|
||||
}));
|
||||
});
|
||||
exportNode.loc = path.node.loc;
|
||||
topNodes.push(exportNode);
|
||||
path.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,6 +7,13 @@ var tests = [
|
||||
'import {bar2, baz} from "foo";',
|
||||
'import {bar as baz2} from "foo";',
|
||||
'import {bar as baz3, xyz} from "foo";',
|
||||
|
||||
'export default 42;',
|
||||
'export {foo};',
|
||||
'export { foo as default };',
|
||||
'export * from "foo";',
|
||||
'export {foo} from "foo";',
|
||||
'export {default as foo} from "foo";',
|
||||
];
|
||||
|
||||
tests.forEach(function (code) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user