【问题标题】:"export 'resize' was not found in '@engineers/graphics/index'“在‘​​@engineers/graphics/index’中找不到导出‘resize’
【发布时间】:2021-03-25 03:08:19
【问题描述】:

我收到了"export 'resize' was not found in '@engineers/graphics'

graphics.ts

https://github.com/eng-dibo/ngx/blob/master/packages/graphics/index.ts#L33

export type Img = string | Buffer | Sharp;
export type Size = number | string | null;
/**
 * [resize description]
 * @method resize
 * @param  {Img} img     file path or image buffer;
 * @param  {Size | Size[]} size    width or [width, height] or 'width,height', if size=null just convert img type
 * @param  {[type]} options [description]
 * @return Promise<info>
 *
 * todo:
 *  - rename size to dimensions
 *  - convert(img) = resize(img,size=null,{output=type})
 */
export function resize(
  img: Img,
  size: Size | Size[],
  options: ResizeOptions = {}
): Promise<any> {}

在其他文件中:

https://github.com/eng-dibo/ngx/blob/master/projects/cms/server/api/v1.ts#L12

import { resize } from "@engineers/graphics/index";

【问题讨论】:

    标签: typescript webpack ts-loader


    【解决方案1】:

    通过修复package.json/name 字段解决。 由于某种原因(我不知道为什么)这个包的包名与同一文件夹中的另一个包相同,所以require('path/to/graphic/package') 加载另一个包,即使它通过路径而不是名称(如require('package-name')

    【讨论】:

      猜你喜欢
      • 2014-09-03
      • 2011-04-23
      • 1970-01-01
      • 2018-12-30
      • 2021-08-17
      • 2014-01-20
      • 2018-02-03
      • 2020-01-19
      • 2021-01-23
      相关资源
      最近更新 更多