mirror of https://github.com/webpack/webpack.git
fix: handle ASI for export declaration
This commit is contained in:
parent
844fe4b2fa
commit
420cb39bdd
|
|
@ -166,6 +166,13 @@ module.exports = class HarmonyExportDependencyParserPlugin {
|
|||
/** @type {DependencyLocation} */ (statement.loc)
|
||||
);
|
||||
dep.loc.index = idx;
|
||||
const isAsiSafe = !parser.isAsiPosition(
|
||||
/** @type {Range} */
|
||||
(statement.range)[0]
|
||||
);
|
||||
if (!isAsiSafe) {
|
||||
parser.setAsiPosition(/** @type {Range} */ (statement.range)[1]);
|
||||
}
|
||||
parser.state.current.addDependency(dep);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
export const fn = (num) => {
|
||||
return num;
|
||||
};
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
import { fn } from './a.js';
|
||||
|
||||
const num = 1
|
||||
|
||||
export { num };
|
||||
|
||||
fn(num);
|
||||
|
||||
it("should work", function() {
|
||||
expect(fn(num)).toBe(1);
|
||||
});
|
||||
Loading…
Reference in New Issue