Skip to content

Conversation

@Single-Dancer
Copy link
Collaborator

@Single-Dancer Single-Dancer commented Apr 23, 2025

这个 PR 做了什么? (简要描述所做更改)
dom-external index.js 里的代码被treeshaking,导致 dangerouslySetInnerHTML 不能正常工作。

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

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

这个 PR 涉及以下平台:

  • 所有小程序
  • 微信小程序
  • 支付宝小程序
  • 百度小程序
  • 字节跳动小程序
  • QQ 轻应用
  • 京东小程序
  • 快应用平台(QuickApp)
  • Web 平台(H5)
  • 移动端(React-Native)
  • 鸿蒙(harmony)

Summary by CodeRabbit

  • Chores
    • 更新依赖配置,优化打包时的副作用文件标记。
    • 全线包版本更新至 4.0.13-alpha.0,提升整体版本一致性。

@coderabbitai
Copy link

coderabbitai bot commented Apr 23, 2025

## Walkthrough

此次更改将多个包的 `package.json` 文件中的版本号统一从 `4.0.12` 更新为 `4.0.13-alpha.0`。其中,`@tarojs/runtime` 包的 `sideEffects` 字段由空数组改为包含 `"./dist/dom-external/index.js"`,标记该文件具有副作用,影响打包工具的 tree-shaking 优化。其余包仅更新了版本号,未修改其他元数据或导出声明。

## Changes

| 文件/路径                                     | 变更摘要                                         |
|-----------------------------------------------|--------------------------------------------------|
| packages/taro-runtime/package.json             | 版本号更新至 `4.0.13-alpha.0``sideEffects` 字段由空数组改为包含 `"./dist/dom-external/index.js"` |
| crates/native_binding/package.json             | 版本号更新至 `4.0.13-alpha.0`,无其他改动          |
| npm/darwin-arm64/package.json                   | 版本号更新至 `4.0.13-alpha.0`,无其他改动          |
| npm/darwin-x64/package.json                     | 版本号更新至 `4.0.13-alpha.0`,无其他改动          |
| npm/linux-x64-gnu/package.json                  | 版本号更新至 `4.0.13-alpha.0`,无其他改动          |
| npm/linux-x64-musl/package.json                  | 版本号更新至 `4.0.13-alpha.0`,无其他改动          |
| npm/win32-x64-msvc/package.json                  | 版本号更新至 `4.0.13-alpha.0`,无其他改动          |
| package.json                                    | 版本号更新至 `4.0.13-alpha.0`,无其他改动          |
| packages/babel-plugin-transform-*-package.json | 版本号更新至 `4.0.13-alpha.0`,无其他改动          |
| packages/babel-preset-taro/package.json         | 版本号更新至 `4.0.13-alpha.0`,无其他改动          |
| packages/create-app/package.json                 | 版本号更新至 `4.0.13-alpha.0`,无其他改动          |
| packages/css-to-react-native/package.json       | 版本号更新至 `4.0.13-alpha.0`,无其他改动          |
| packages/eslint-config-taro/package.json        | 版本号更新至 `4.0.13-alpha.0`,无其他改动          |
| packages/jest-helper/package.json                | 版本号更新至 `4.0.13-alpha.0`,无其他改动          |
| packages/postcss-*-package.json                  | 版本号更新至 `4.0.13-alpha.0`,无其他改动          |
| packages/rollup-plugin-copy/package.json         | 版本号更新至 `4.0.13-alpha.0`,无其他改动          |
| packages/shared/package.json                      | 版本号更新至 `4.0.13-alpha.0`,无其他改动          |
| packages/stylelint-*-package.json                 | 版本号更新至 `4.0.13-alpha.0`,无其他改动          |
| packages/taro-*/package.json                      | 版本号更新至 `4.0.13-alpha.0`,无其他改动          |
| packages/taro-framework-*/package.json            | 版本号更新至 `4.0.13-alpha.0`,无其他改动          |
| packages/taro-plugin-*/package.json               | 版本号更新至 `4.0.13-alpha.0`,无其他改动          |
| packages/taro-components-*/package.json           | 版本号更新至 `4.0.13-alpha.0`,无其他改动          |
| packages/taro-rn-*/package.json                    | 版本号更新至 `4.0.13-alpha.0`,无其他改动          |
| packages/taro-webpack5-*/package.json              | 版本号更新至 `4.0.13-alpha.0`,无其他改动          |
| packages/taroize/package.json                       | 版本号更新至 `4.0.13-alpha.0`,无其他改动          |

## Suggested reviewers

- tutuxxx  
- luckyadam

## Poem

> 🐇  
> 轻点脚步动一行,  
> 副作用文件加标明。  
> 打包工具细分明,  
> 优化流程更清清。  
> 小兔挥笔记新程,  
> 代码世界又一春!

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f1d3a0f and b1317a3.

📒 Files selected for processing (75)
  • crates/native_binding/package.json (1 hunks)
  • npm/darwin-arm64/package.json (1 hunks)
  • npm/darwin-x64/package.json (1 hunks)
  • npm/linux-x64-gnu/package.json (1 hunks)
  • npm/linux-x64-musl/package.json (1 hunks)
  • npm/win32-x64-msvc/package.json (1 hunks)
  • package.json (1 hunks)
  • packages/babel-plugin-transform-react-jsx-to-rn-stylesheet/package.json (1 hunks)
  • packages/babel-plugin-transform-solid-jsx/package.json (1 hunks)
  • packages/babel-plugin-transform-taroapi/package.json (1 hunks)
  • packages/babel-preset-taro/package.json (1 hunks)
  • packages/create-app/package.json (1 hunks)
  • packages/css-to-react-native/package.json (1 hunks)
  • packages/eslint-config-taro/package.json (1 hunks)
  • packages/jest-helper/package.json (1 hunks)
  • packages/postcss-html-transform/package.json (1 hunks)
  • packages/postcss-plugin-constparse/package.json (1 hunks)
  • packages/postcss-pxtransform/package.json (1 hunks)
  • packages/postcss-unit-transform/package.json (1 hunks)
  • packages/rollup-plugin-copy/package.json (1 hunks)
  • packages/shared/package.json (1 hunks)
  • packages/stylelint-config-taro-rn/package.json (1 hunks)
  • packages/stylelint-taro-rn/package.json (1 hunks)
  • packages/stylelint-taro/package.json (1 hunks)
  • packages/taro-api/package.json (1 hunks)
  • packages/taro-cli-convertor/package.json (1 hunks)
  • packages/taro-cli/package.json (1 hunks)
  • packages/taro-components-advanced/package.json (1 hunks)
  • packages/taro-components-library-react/package.json (1 hunks)
  • packages/taro-components-library-solid/package.json (1 hunks)
  • packages/taro-components-library-vue3/package.json (1 hunks)
  • packages/taro-components-react/package.json (1 hunks)
  • packages/taro-components-rn/package.json (1 hunks)
  • packages/taro-components/package.json (1 hunks)
  • packages/taro-extend/package.json (1 hunks)
  • packages/taro-framework-react/package.json (1 hunks)
  • packages/taro-framework-solid/package.json (1 hunks)
  • packages/taro-framework-vue3/package.json (1 hunks)
  • packages/taro-h5/package.json (1 hunks)
  • packages/taro-helper/package.json (1 hunks)
  • packages/taro-loader/package.json (1 hunks)
  • packages/taro-platform-alipay/package.json (1 hunks)
  • packages/taro-platform-h5/package.json (1 hunks)
  • packages/taro-platform-harmony-hybrid/package.json (1 hunks)
  • packages/taro-platform-harmony/package.json (1 hunks)
  • packages/taro-platform-jd/package.json (1 hunks)
  • packages/taro-platform-qq/package.json (1 hunks)
  • packages/taro-platform-swan/package.json (1 hunks)
  • packages/taro-platform-tt/package.json (1 hunks)
  • packages/taro-platform-weapp/package.json (1 hunks)
  • packages/taro-plugin-html/package.json (1 hunks)
  • packages/taro-plugin-http/package.json (1 hunks)
  • packages/taro-plugin-inject/package.json (1 hunks)
  • packages/taro-plugin-mini-ci/package.json (1 hunks)
  • packages/taro-plugin-react-devtools/package.json (1 hunks)
  • packages/taro-plugin-vue-devtools/package.json (1 hunks)
  • packages/taro-react/package.json (1 hunks)
  • packages/taro-rn-runner/package.json (1 hunks)
  • packages/taro-rn-style-transformer/package.json (1 hunks)
  • packages/taro-rn-supporter/package.json (1 hunks)
  • packages/taro-rn-transformer/package.json (1 hunks)
  • packages/taro-rn/package.json (1 hunks)
  • packages/taro-router-rn/package.json (1 hunks)
  • packages/taro-router/package.json (1 hunks)
  • packages/taro-runner-utils/package.json (1 hunks)
  • packages/taro-runtime-rn/package.json (1 hunks)
  • packages/taro-runtime/package.json (2 hunks)
  • packages/taro-service/package.json (1 hunks)
  • packages/taro-transformer-wx/package.json (1 hunks)
  • packages/taro-vite-runner/package.json (1 hunks)
  • packages/taro-webpack5-prebundle/package.json (1 hunks)
  • packages/taro-webpack5-runner/package.json (1 hunks)
  • packages/taro-with-weapp/package.json (1 hunks)
  • packages/taro/package.json (1 hunks)
  • packages/taroize/package.json (1 hunks)
✅ Files skipped from review due to trivial changes (74)
  • packages/taro-vite-runner/package.json
  • packages/taro-components-library-solid/package.json
  • packages/babel-plugin-transform-solid-jsx/package.json
  • packages/taro-components/package.json
  • packages/taro-framework-react/package.json
  • packages/taro-runtime-rn/package.json
  • packages/postcss-plugin-constparse/package.json
  • packages/taro-framework-vue3/package.json
  • packages/taro-rn/package.json
  • npm/darwin-x64/package.json
  • packages/css-to-react-native/package.json
  • packages/taro-platform-h5/package.json
  • packages/taro-helper/package.json
  • crates/native_binding/package.json
  • packages/stylelint-taro-rn/package.json
  • packages/taro/package.json
  • packages/taro-react/package.json
  • packages/taro-router/package.json
  • package.json
  • packages/rollup-plugin-copy/package.json
  • packages/taro-transformer-wx/package.json
  • packages/taro-plugin-inject/package.json
  • packages/taro-plugin-react-devtools/package.json
  • packages/taro-platform-alipay/package.json
  • packages/taro-components-advanced/package.json
  • packages/taro-rn-transformer/package.json
  • packages/taro-platform-jd/package.json
  • packages/taro-framework-solid/package.json
  • packages/taro-components-library-vue3/package.json
  • packages/taro-plugin-mini-ci/package.json
  • npm/win32-x64-msvc/package.json
  • packages/taro-router-rn/package.json
  • npm/darwin-arm64/package.json
  • packages/taro-platform-harmony-hybrid/package.json
  • packages/postcss-html-transform/package.json
  • packages/taro-extend/package.json
  • packages/jest-helper/package.json
  • packages/taro-cli/package.json
  • packages/taro-rn-style-transformer/package.json
  • packages/shared/package.json
  • packages/taro-platform-tt/package.json
  • packages/taro-rn-supporter/package.json
  • packages/postcss-unit-transform/package.json
  • packages/postcss-pxtransform/package.json
  • packages/taro-rn-runner/package.json
  • packages/taro-api/package.json
  • packages/babel-plugin-transform-taroapi/package.json
  • packages/babel-plugin-transform-react-jsx-to-rn-stylesheet/package.json
  • packages/taroize/package.json
  • packages/babel-preset-taro/package.json
  • packages/taro-with-weapp/package.json
  • packages/taro-components-rn/package.json
  • packages/taro-components-react/package.json
  • packages/taro-plugin-vue-devtools/package.json
  • packages/taro-loader/package.json
  • packages/stylelint-taro/package.json
  • packages/stylelint-config-taro-rn/package.json
  • packages/taro-service/package.json
  • packages/eslint-config-taro/package.json
  • packages/taro-webpack5-runner/package.json
  • npm/linux-x64-musl/package.json
  • packages/create-app/package.json
  • packages/taro-h5/package.json
  • packages/taro-runner-utils/package.json
  • packages/taro-components-library-react/package.json
  • packages/taro-platform-swan/package.json
  • packages/taro-plugin-http/package.json
  • packages/taro-platform-harmony/package.json
  • packages/taro-plugin-html/package.json
  • packages/taro-platform-qq/package.json
  • packages/taro-platform-weapp/package.json
  • packages/taro-webpack5-prebundle/package.json
  • packages/taro-cli-convertor/package.json
  • npm/linux-x64-gnu/package.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/taro-runtime/package.json
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: Build Rust Binding / stable - aarch64-apple-darwin
  • GitHub Check: Build Rust Binding / stable - x86_64-pc-windows-msvc
  • GitHub Check: Build Rust Binding / stable - x86_64-apple-darwin
  • GitHub Check: Build Rust Binding / stable - aarch64-apple-darwin
  • GitHub Check: Build Rust Binding / stable - x86_64-pc-windows-msvc
  • GitHub Check: Build Rust Binding / stable - x86_64-pc-windows-msvc
  • GitHub Check: Build Rust Binding / stable - x86_64-apple-darwin

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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

🧹 Nitpick comments (1)
packages/taro-runtime/package.json (1)

15-17: 建议使用通配符扩展副作用目录
当前仅指定了单个文件,如果 dom-external 目录下还包含其他副作用文件(如子模块或样式文件),建议使用 glob 通配符标记整个目录:

-  "sideEffects": [
-    "./dist/dom-external/index.js"
-  ],
+  "sideEffects": [
+    "./dist/dom-external/**/*.js"
+  ],

这样可以确保目录下的所有 JavaScript 文件都不会被 tree-shaking 剔除。

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ac2dfa4 and f1d3a0f.

📒 Files selected for processing (1)
  • packages/taro-runtime/package.json (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: Build Rust Binding / stable - aarch64-apple-darwin
  • GitHub Check: Build Rust Binding / stable - x86_64-unknown-linux-musl
  • GitHub Check: Build Rust Binding / stable - x86_64-unknown-linux-gnu
  • GitHub Check: Build Rust Binding / stable - x86_64-apple-darwin
  • GitHub Check: Build Rust Binding / stable - x86_64-pc-windows-msvc
  • GitHub Check: Build Rust WASM / stable - wasm32-wasi
  • GitHub Check: Build Rust Binding / stable - aarch64-apple-darwin
  • GitHub Check: Build Rust Binding / stable - x86_64-pc-windows-msvc
🔇 Additional comments (1)
packages/taro-runtime/package.json (1)

15-17: 已正确修复 dom-external 被 Tree-Shaking 移除的问题
sideEffects 从空数组修改为包含 ./dist/dom-external/index.js 可阻止该模块被剔除,满足 PR 目标。

Comment on lines +15 to +17
"sideEffects": [
"./dist/dom-external/index.js"
],
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

❓ Verification inconclusive

确认副作用文件路径正确性
请确保在构建产物中存在 dist/dom-external/index.js,以便 webpack 等打包工具在 tree-shaking 时保留该文件。


🏁 Script executed:

#!/bin/bash
# 验证构建产物中是否包含 dom-external/index.js
if [ ! -f dist/dom-external/index.js ]; then
  echo "缺少 dist/dom-external/index.js,sideEffects 配置可能无效" >&2
  exit 1
else
  echo "dist/dom-external/index.js 存在"
fi

Length of output: 159


修复:确保 sideEffects 指定的文件存在
packages/taro-runtime/package.json 中配置了:

"sideEffects": [
  "./dist/dom-external/index.js"
]

但经验证,构建产物中缺少 dist/dom-external/index.js,会导致 webpack 等工具在 tree‑shaking 时错误地移除此模块。

请在以下两点中选一并执行:

  • 若该模块仍需保留,补充或修正构建脚本,确保最终产物中生成 packages/taro-runtime/dist/dom-external/index.js
  • 若该文件已废弃,删除或更新 sideEffects 中对应的路径。

@coderabbitai coderabbitai bot requested review from luckyadam and tutuxxx April 23, 2025 05:39
@codecov
Copy link

codecov bot commented Apr 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 58.37%. Comparing base (ac2dfa4) to head (b1317a3).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##             main   #17584    +/-   ##
========================================
  Coverage   58.37%   58.37%            
========================================
  Files         469      469            
  Lines       27230    27230            
  Branches     5752     5953   +201     
========================================
  Hits        15895    15895            
+ Misses       9962     9939    -23     
- Partials     1373     1396    +23     
Flag Coverage Δ
taro-cli 72.37% <ø> (ø)
taro-runtime 59.87% <ø> (ø)
taro-web 52.75% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

see 12 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Single-Dancer Single-Dancer added this to the 4.0.13 milestone Apr 23, 2025
@Single-Dancer Single-Dancer merged commit b6a20fe into main Apr 24, 2025
43 checks passed
@Single-Dancer Single-Dancer deleted the fix/side-effects branch April 24, 2025 12:41
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.

3 participants