Javascript ES6&x2B;Babel:Getting-TypeError:actions.helloOne()不是函数

Javascript ES6&x2B;Babel:Getting-TypeError:actions.helloOne()不是函数,javascript,ecmascript-6,babeljs,Javascript,Ecmascript 6,Babeljs,我开始用webpack和babel构建React应用程序(弹出创建React应用程序)。但是,我无法导入带有实用程序函数的外部.js文件 每当我尝试调用actions.helloOne()时,我都会遇到以下错误:TypeError:actions.helloOne不是函数 我对JS还是一个新手,所以我可能遗漏了一些明显的东西 helloActions.js export function helloOne() { console.log('one') } export function he

我开始用webpack和babel构建React应用程序(弹出创建React应用程序)。但是,我无法导入带有实用程序函数的外部.js文件

每当我尝试调用
actions.helloOne()
时,我都会遇到以下错误:
TypeError:actions.helloOne不是函数

我对JS还是一个新手,所以我可能遗漏了一些明显的东西

helloActions.js

export function helloOne() {
  console.log('one')
}
export function helloTwo() {
  console.log('two')
}
import { helloOne, helloTwo } from './helloActions'

export {
  helloOne,
  helloTwo
}
import * as actions from './actions'

actions.helloOne(); <-   undefined
actions.js

export function helloOne() {
  console.log('one')
}
export function helloTwo() {
  console.log('two')
}
import { helloOne, helloTwo } from './helloActions'

export {
  helloOne,
  helloTwo
}
import * as actions from './actions'

actions.helloOne(); <-   undefined
service.js

export function helloOne() {
  console.log('one')
}
export function helloTwo() {
  console.log('two')
}
import { helloOne, helloTwo } from './helloActions'

export {
  helloOne,
  helloTwo
}
import * as actions from './actions'

actions.helloOne(); <-   undefined

我设法解决了我的问题,代码是正确的,正如Andrew Li所提到的


我在导入行中的一个文件的路径上有一个小错误(最后基本上错过了.js,这导致babel在没有抛出错误的情况下做了一些奇怪的事情)。

import*as actions
?为什么不导入操作呢?这很奇怪。它对我来说很好。@AndrewLi是的,它对我来说似乎100%正确,所有其他例子也一样。可能是babel上的坏版本还是别的什么?这就是你的全部代码吗?我刚刚用ES2015预设和最新的Babel测试了该代码,效果很好。差不多就是这样。还有更多,但我没有以任何方式与之互动。