Skip to content

Commit 5146ee5

Browse files
committed
Don't detect exportDeclaration when named function expression
Fixes webpack#6867
1 parent 54ceb3c commit 5146ee5

4 files changed

Lines changed: 17 additions & 0 deletions

File tree

‎lib/Parser.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,6 +1179,7 @@ class Parser extends Tapable {
11791179
walkExportDefaultDeclaration(statement) {
11801180
this.hooks.export.call(statement);
11811181
if (statement.declaration.id) {
1182+
if (statement.declaration.id && statement.declaration.type !== 'FunctionExpression') {
11821183
if (
11831184
!this.hooks.exportDeclaration.call(statement, statement.declaration)
11841185
) {
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import test from './test';
2+
3+
it("should compile default export with function expressions", function() {
4+
return import(/* webpackChunkName: "test" */ "./test")
5+
.then(({ default: one }) => {
6+
one().should.be.eql(1)
7+
});
8+
});
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default (function hello () {
2+
return 1;
3+
})
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
optimization: {
3+
minimize: false
4+
}
5+
};

0 commit comments

Comments
 (0)