导入的对象未定义。

时间:2018-02-09 21:27:07

标签: javascript import ecmascript-6

在下面的代码中,在uploadEditImageEpic中,s3options未定义。这是为什么?它只是从导出对象的文件导入。

组件/ addPage / epic.js

import type { S3Options } from '../../types/image'

export const s3options: S3Options = {
  keyPrefix: 'xxxx',
  bucket: 'xxx',
  region: 'xxx',
  accessKey: 'xxx',
  secretKey: 'xxx',
  successActionStatus: xxx
}

组件/ editProduct / epic.js

import { s3options } from '../addPage/epic'

export const uploadEditImageEpic: Epic<*, *, *> = (
  action$: ActionsObservable<*>
) =>
  action$.ofType(UPLOAD_EDIT_IMAGE).mergeMap(action => {
    return Observable.fromPromise(RNS3.put(action.payload, s3options))
      .map((response: AjaxResponse) => uploadEditImageFulfilled(response))
      .catch((error: AjaxResponse) => {
        return Observable.of(uploadEditImageRejected(error))
      })
  })

类型/ image.js

export type S3Options = {
  [x: string]: any,
  keyPrefix: string,
  bucket: string,
  region: string,
  accessKey: string,
  secretKey: string,
  successActionStatus: number
}

0 个答案:

没有答案