[英]How to abstract next/image from next.js
I'm only using the next/image from Next.js.我只使用来自 Next.js 的下一个/图像。 Is there a way to only install next/image module and not the entire Next.js module.有没有办法只安装下一个/图像模块而不是整个 Next.js 模块。 I tried doing the following -我尝试执行以下操作 -
"next/image": "^10.0.5",
"next/link": "^10.0.5",
But after doing npm install I'm getting the following error -但是在安装 npm 之后,我收到以下错误 -
$ npm install
npm ERR! code EINVALIDPACKAGENAME
npm ERR! Invalid package name "next/image": name can only contain URL-friendly characters
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\sugamxp\AppData\Roaming\npm-cache\_logs\2021-02-17T06_08_55_518Z-debug.log
There is no such package next/image
, it is just a folder inside next
package, so no, you cannot install it separately.没有这样的 package next/image
,它只是next
package 中的一个文件夹,所以不,你不能单独安装它。
Moreover, you can't use it separately without NextJs because it relies on NextJs server to optimize images on demand.而且,你不能没有 NextJs 单独使用它,因为它依赖 NextJs 服务器来按需优化图像。 I guess, you would need to find another solution if you want image optimization.我想,如果你想要图像优化,你需要找到另一个解决方案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.