anonimitoraf / skerrick

REPL-driven development for NodeJS
GNU General Public License v3.0
103 stars 6 forks source link

Error when exporting a nameless fn as default #2

Closed anonimitoraf closed 2 years ago

anonimitoraf commented 2 years ago
export default function () { return 'this is changed' };

=>

TypeError: /home/anonimito/temp/temp-2.js: Cannot read properties of null (reading 'name')
    at PluginPass.ExportDefaultDeclaration (/home/anonimito/.nvs/node/17.3.0/x64/lib/node_modules/skerrick/dist/engine.js:346:43)
    at newFn (/home/anonimito/.nvs/node/17.3.0/x64/lib/node_modules/skerrick/node_modules/@babel/traverse/lib/visitors.js:177:21)
    at NodePath._call (/home/anonimito/.nvs/node/17.3.0/x64/lib/node_modules/skerrick/node_modules/@babel/traverse/lib/path/context.js:53:20)
    at NodePath.call (/home/anonimito/.nvs/node/17.3.0/x64/lib/node_modules/skerrick/node_modules/@babel/traverse/lib/path/context.js:40:17)
    at NodePath.visit (/home/anonimito/.nvs/node/17.3.0/x64/lib/node_modules/skerrick/node_modules/@babel/traverse/lib/path/context.js:100:31)
    at TraversalContext.visitQueue (/home/anonimito/.nvs/node/17.3.0/x64/lib/node_modules/skerrick/node_modules/@babel/traverse/lib/context.js:103:16)
    at TraversalContext.visitMultiple (/home/anonimito/.nvs/node/17.3.0/x64/lib/node_modules/skerrick/node_modules/@babel/traverse/lib/context.js:72:17)
    at TraversalContext.visit (/home/anonimito/.nvs/node/17.3.0/x64/lib/node_modules/skerrick/node_modules/@babel/traverse/lib/context.js:129:19)
    at traverseNode (/home/anonimito/.nvs/node/17.3.0/x64/lib/node_modules/skerrick/node_modules/@babel/traverse/lib/traverse-node.js:24:17)
    at NodePath.visit (/home/anonimito/.nvs/node/17.3.0/x64/lib/node_modules/skerrick/node_modules/@babel/traverse/lib/path/context.js:107:52)
anonimitoraf commented 2 years ago

Fixed with https://github.com/anonimitoraf/skerrick/commit/bd385676615c92a242127ecbf8cb2a7122071ebf