I can't get export default { multiple, functions } to work.
Heres my setup:
src/index.js:
import {foo} from './foo'
foo();
foo.js:
const foo = () => {
console.log("Hello!");
}
export default {foo};
and my package.json:
{
"name": "jestjs.io",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "babel-node src/index.js",
"test": "jest"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@babel/core": "^7.4.5",
"@babel/node": "^7.4.5",
"@babel/preset-env": "^7.4.5",
"babel-jest": "^24.8.0",
"jest": "^24.8.0",
"nodemon": "^1.19.1"
}
}
when I run npm start, I get the following error message:
/src/index.js:5
(0, _foo.foo)();
^
TypeError: (0 , _foo.foo) is not a function
However, if I export default foo and import foo without the curly braces {foo}, it executes and I get Hello! printed to the terminal.
What am I doing wrong ?