-2
我的包JSON被配置爲使用通天使用ES6模塊:爲什麼此代碼會記錄'未定義'?
"scripts": {
"start": "nodemon src/index.js --exec babel-node --presets es2015,stage-2",
"build": "babel src -d dist",
"serve": "node dist/index.js"
},
這是我的索引文件:
import test from './test'
console.log(test)
console.log(test())
測試文件:
let test =() => console.log('test');
export default test;
當我運行代碼,我得到了:
[Function: test]
test
undefined
undefined來自哪裏?