amis icon indicating copy to clipboard operation
amis copied to clipboard

这个PDF相关的组件PdfViewer,能不能定制他是否加载?

Open bamzc opened this issue 2 years ago • 2 comments

是否关联于某个问题吗:

这个PDF相关的组件PdfViewer使用了react-pdf组件库,在服务器构建的时候,会安装并且编译canvas组件。如果硬件资源较差,编译时间会很长。硬件资源 canvas 的 C/C++ 部分依赖于 cairo、pango 等图形库,编译这些库需要大量 CPU 和内存资源。

预期的解决方案:

使用者可以定制是否加载某个组件,并且屏蔽某个组件的打包编译行为。

其他可接受方案:

或者有没有其他替代方案?不要使用耗费性能这么搞的组件。

任何附加信息:

npm info run [email protected] install node_modules/canvas node-pre-gyp install --fallback-to-build --update-binary 这个安装过程会持续几个小时,非常麻烦!

bamzc avatar Apr 17 '24 08:04 bamzc

安装命令加上 --ignore-scripts 试试?

npm i --ignore-scripts

2betop avatar Apr 17 '24 08:04 2betop

安装命令加上 --ignore-scripts 试试?

npm i --ignore-scripts

没用。。 它的依赖似乎有点深。。总是莫名其妙的问题 能不能将这些内容移入到可选包啊? 通过配置的方式手动启用他们?

> yarn --ignore-scripts
yarn install v1.22.19
[1/5] Validating package.json...
[2/5] Resolving packages...
warning amis > [email protected]: This was arguably a breaking change. Not in API, but more results can be returned. Upgrade to the next major when you are ready for that
warning amis > amis-core > [email protected]: This was arguably a breaking change. Not in API, but more results can be returned. Upgrade to the next major when you are ready for that
warning amis > amis-ui > [email protected]: This was arguably a breaking change. Not in API, but more results can be returned. Upgrade to the next major when you are ready for that
warning amis > exceljs > unzipper > [email protected]: This package is no longer supported.
warning amis > exceljs > archiver > zip-stream > archiver-utils > [email protected]: Glob versions prior to v9 are no longer supported
warning amis > exceljs > unzipper > fstream > [email protected]: Rimraf versions prior to v4 are no longer supported
warning amis > amis-ui > react-pdf > pdfjs-dist > canvas > @mapbox/node-pre-gyp > [email protected]: Rimraf versions prior to v4 are no longer supported
warning amis > amis-ui > react-pdf > pdfjs-dist > canvas > @mapbox/node-pre-gyp > [email protected]: This package is no longer supported.
warning amis > amis-ui > react-pdf > pdfjs-dist > canvas > @mapbox/node-pre-gyp > npmlog > [email protected]: This package is no longer supported.
warning amis > amis-ui > react-pdf > pdfjs-dist > canvas > @mapbox/node-pre-gyp > npmlog > [email protected]: This package is no longer supported.
error An unexpected error occurred: "https://github.com/xqq/webworkify-webpack: connect ETIMEDOUT 20.205.243.166:443".
info If you think this is a bug, please open a bug report with the information provided in "\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

hyzx86 avatar Jan 19 '25 13:01 hyzx86