Skip to content

fix(service): webpack-chain should be dependencies of @tarojs/service#18709

Open
Amour1688 wants to merge 1 commit intoNervJS:mainfrom
Amour1688:fix-service-deps
Open

fix(service): webpack-chain should be dependencies of @tarojs/service#18709
Amour1688 wants to merge 1 commit intoNervJS:mainfrom
Amour1688:fix-service-deps

Conversation

@Amour1688
Copy link

@Amour1688 Amour1688 commented Dec 31, 2025

这个 PR 做了什么? (简要描述所做更改)

修复外部使用 @tarojs/service 获取不到 webpack-chain 类型的问题

image

这个 PR 是什么类型? (至少选择一个)

  • 错误修复 (Bugfix) issue: fix #
  • 新功能 (Feature)
  • 代码重构 (Refactor)
  • TypeScript 类型定义修改 (Types)
  • 文档修改 (Docs)
  • 代码风格更新 (Code style update)
  • 构建优化 (Chore)
  • 其他,请描述 (Other, please describe):

这个 PR 涉及以下平台:

  • 所有平台
  • Web 端(H5)
  • 移动端(React-Native)
  • 鸿蒙(Harmony)
  • 鸿蒙容器(Harmony Hybrid)
  • ASCF 元服务
  • 快应用(QuickApp)
  • 所有小程序
  • 微信小程序
  • 企业微信小程序
  • 京东小程序
  • 百度小程序
  • 支付宝小程序
  • 支付宝 IOT 小程序
  • 钉钉小程序
  • QQ 小程序
  • 飞书小程序
  • 快手小程序
  • 头条小程序

Summary by CodeRabbit

发布说明

  • Chores(杂务)
    • 调整依赖配置,将 Taro 框架移至生产依赖以确保功能可用性。
    • 优化开发工具依赖的分类。

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 31, 2025

概览

调整 taro-service 包的依赖声明,将 webpack-merge 从生产依赖移至开发依赖,同时将 @tarojs/taro 从开发依赖升级为生产依赖。

变更

聚合分类 / 文件 变更摘要
依赖管理
packages/taro-service/package.json
webpack-mergedependencies 移至 devDependencies;将 @tarojs/tarodevDependencies 提升至 dependencies

预期代码审查工作量

🎯 1 (简单) | ⏱️ ~3 分钟

推荐审查人

  • yoyo837
  • tutuxxx

诗文

🐰 兔子来整理依赖啦,
webpack 去了开发间,
taro 升级做主角,
生产之路更宽敞!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title check ⚠️ Warning 标题提到 webpack-chain 应作为依赖,但实际变更中仅有 webpack-merge 的移动和 @tarojs/taro 的依赖调整,未涉及 webpack-chain 更新标题以准确反映实际变更:移动 webpack-merge 到 devDependencies 并将 @tarojs/taro 调整为 dependencies。
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai bot requested review from tutuxxx and yoyo837 December 31, 2025 07:39
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4e186a3 and ea9d0f6.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (1)
  • packages/taro-service/package.json
🧰 Additional context used
🧠 Learnings (5)
📚 Learning: 2025-08-08T02:32:58.265Z
Learnt from: ianzone
Repo: NervJS/taro PR: 18146
File: packages/babel-plugin-transform-react-jsx-to-rn-stylesheet/package.json:12-14
Timestamp: 2025-08-08T02:32:58.265Z
Learning: 在 Taro 项目的 pnpm 工作区中,Vitest 相关依赖(vitest 和 vitest/coverage-istanbul)被管理在根目录的 package.json 中,而不是各个子包的 devDependencies 中。这是 monorepo 中依赖提升的标准做法。

Applied to files:

  • packages/taro-service/package.json
📚 Learning: 2025-11-21T07:15:22.634Z
Learnt from: ianzone
Repo: NervJS/taro PR: 18646
File: packages/taro/package.json:40-40
Timestamp: 2025-11-21T07:15:22.634Z
Learning: 在 tarojs/taro 包中添加 vite 作为 devDependency 是为了让 tarojs/vite-runner 能够依赖正确的 vite 类型版本,确保 monorepo 中的类型兼容性。

Applied to files:

  • packages/taro-service/package.json
📚 Learning: 2025-08-25T22:16:50.118Z
Learnt from: ianzone
Repo: NervJS/taro PR: 18150
File: packages/babel-plugin-transform-taroapi/tests/__mocks__/h5-definition.json:2356-2356
Timestamp: 2025-08-25T22:16:50.118Z
Learning: The file `packages/babel-plugin-transform-taroapi/tests/__mocks__/h5-definition.json` is auto-generated by the post-build script `packages/taro-platform-h5/scripts/post-build.mjs`, which copies content from `taro-platform-h5/dist/definition.json`. This file should not be manually edited.

Applied to files:

  • packages/taro-service/package.json
📚 Learning: 2025-05-25T18:02:31.387Z
Learnt from: ianzone
Repo: NervJS/taro PR: 17746
File: packages/taro-runtime/tsdown.config.ts:10-16
Timestamp: 2025-05-25T18:02:31.387Z
Learning: 在 taro-runtime 包的 tsdown 配置中,必须禁用 treeshake 来保留 dom-external/index.js 文件。

Applied to files:

  • packages/taro-service/package.json
📚 Learning: 2025-09-05T18:40:45.775Z
Learnt from: ianzone
Repo: NervJS/taro PR: 18150
File: packages/taro-platform-harmony-hybrid/package.json:43-45
Timestamp: 2025-09-05T18:40:45.775Z
Learning: 在 tarojs/plugin-platform-harmony-hybrid 包中,tarojs/components-library-react、tarojs/components-library-solid 和 tarojs/components-library-vue3 必须作为直接依赖(dependencies)而不能作为 peer 依赖,因为插件源码中有对这些包的直接引用,包括 componentAdapter* getter 方法和 webpack 别名配置。

Applied to files:

  • packages/taro-service/package.json
🔇 Additional comments (2)
packages/taro-service/package.json (2)

44-44: 确认 webpack-chain 正确位于 dependencies 中

webpack-chain 位于 dependencies 中是正确的,这符合 PR 的目标——确保外部使用者可以获取 webpack-chain 的类型定义。由于 @tarojs/service 的公共 API 可能会暴露 webpack-chain 的类型,将其作为 dependencies 而非 devDependencies 是必要的。


36-36: @tarojs/taro 仅被用于类型定义,应放在 devDependencies 而非 dependencies

AppConfig 是从 @tarojs/taro 导入的接口(纯类型定义),仅在 packages/taro-service/src/utils/types.ts:146 的类型注解中使用:modifyAppConfig: (fn: (args: { appConfig: AppConfig }) => void) => void。由于 TypeScript 在编译时会擦除类型信息,@tarojs/taro 不会包含在运行时代码中,应当作为 devDependency。建议改为 import type { AppConfig } from '@tarojs/taro' 以进一步明确意图。

⛔ Skipped due to learnings
Learnt from: ianzone
Repo: NervJS/taro PR: 18150
File: packages/taro-platform-harmony-hybrid/package.json:43-45
Timestamp: 2025-09-05T18:40:45.775Z
Learning: 在 tarojs/plugin-platform-harmony-hybrid 包中,tarojs/components-library-react、tarojs/components-library-solid 和 tarojs/components-library-vue3 必须作为直接依赖(dependencies)而不能作为 peer 依赖,因为插件源码中有对这些包的直接引用,包括 componentAdapter* getter 方法和 webpack 别名配置。
Learnt from: ianzone
Repo: NervJS/taro PR: 18646
File: packages/taro/package.json:40-40
Timestamp: 2025-11-21T07:15:22.634Z
Learning: 在 tarojs/taro 包中添加 vite 作为 devDependency 是为了让 tarojs/vite-runner 能够依赖正确的 vite 类型版本,确保 monorepo 中的类型兼容性。
Learnt from: ianzone
Repo: NervJS/taro PR: 18146
File: packages/babel-plugin-transform-react-jsx-to-rn-stylesheet/package.json:12-14
Timestamp: 2025-08-08T02:32:58.265Z
Learning: 在 Taro 项目的 pnpm 工作区中,Vitest 相关依赖(vitest 和 vitest/coverage-istanbul)被管理在根目录的 package.json 中,而不是各个子包的 devDependencies 中。这是 monorepo 中依赖提升的标准做法。
Learnt from: ianzone
Repo: NervJS/taro PR: 17746
File: packages/taro-runtime/tsdown.config.ts:10-16
Timestamp: 2025-05-25T18:02:31.387Z
Learning: 在 taro-runtime 包的 tsdown 配置中,必须禁用 treeshake 来保留 dom-external/index.js 文件。
Learnt from: ianzone
Repo: NervJS/taro PR: 18649
File: packages/taroize/src/wxml.ts:731-731
Timestamp: 2025-11-24T08:49:07.365Z
Learning: 在 packages/taroize/src/wxml.ts 中,prettier.format() 返回值的 `as string` 类型断言是必要的,因为需要将结果重新赋值给类型为 `string | undefined` 的变量,而 prettier.format() 的返回类型可能是 `string | Promise<string>`,TypeScript 无法自动收窄类型。
Learnt from: ianzone
Repo: NervJS/taro PR: 18150
File: packages/babel-plugin-transform-taroapi/tests/__mocks__/h5-definition.json:2356-2356
Timestamp: 2025-08-25T22:16:50.118Z
Learning: The file `packages/babel-plugin-transform-taroapi/tests/__mocks__/h5-definition.json` is auto-generated by the post-build script `packages/taro-platform-h5/scripts/post-build.mjs`, which copies content from `taro-platform-h5/dist/definition.json`. This file should not be manually edited.
Learnt from: ianzone
Repo: NervJS/taro PR: 18578
File: .github/workflows/nodejs.yml:191-191
Timestamp: 2025-11-06T11:19:51.376Z
Learning: 在 Taro 项目的 pnpm workspace 中,`pnpm install` 在仓库根目录执行时会自动递归安装所有 workspace 包的依赖并链接本地包(因为 pnpm 的 recursiveInstall 默认为 true),因此 `pnpm install` 和 `pnpm -r install` 在根目录是等效的。

Copy link
Collaborator

@Single-Dancer Single-Dancer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

直接挪到Dependency里不太合适,加peerDependency合理些

@Amour1688
Copy link
Author

直接挪到Dependency里不太合适,加peerDependency合理些

为什么是 peerDependency,依赖 @tajs/service 的包为什么要装 webpack-chain

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants