bug: A warning will appear when building with vite `[plugin vite:resolve] Module "util" has been externalized for browser compatibility`.

未关闭
#1,379 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
typescript, vite
领域
build-system

调研方向

从链接的 StackBlitz 复现开始,并查看针对 pngjs/lib/png.js 的 Vite 警告。阅读 pngjs 的上游 issue #288,并追踪 Jimp 1.6.0 如何将 pngjs 引入构建。复现能够在没有 module-externalization warning 的情况下构建即表示完成。

由索引模型根据 Issue 内容生成。

描述

Expected Behavior

The build is normal, and there should be no warnings.

Current Behavior

Currently, the following warning appears when using vite for building.

[plugin:vite:resolve] [plugin vite:resolve] Module "util" has been externalized for browser compatibility, imported by "/node_modules/.pnpm/[email protected]/node_modules/pngjs/lib/png.js". See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.

Failure Information (for bugs)

It seems to be a problem with the upstream pngjs, but I will report it here as well. https://github.com/pngjs/pngjs/issues/288

Steps to Reproduce

https://stackblitz.com/edit/vitejs-vite-g1cyszx3?file=src%2FApp.tsx

Screenshots

Image

Context

  • Jimp Version: ^1.6.0
  • Operating System: Mac
  • Node version: v18.20.3

Failure Logs

主要语言
TypeScript
星标
14.7k
派生
777
PR 合并指标
30 天内没有已合并 PR

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

jimp-dev/jimp 的其他 Issue

查看 jimp-dev/jimp 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。