Skip to content

fix: 🐛 js.map file use js file's path in stat.json#1506

Merged
stormslowly merged 2 commits intomasterfrom
fix/state_map_wrong_path
Aug 20, 2024
Merged

fix: 🐛 js.map file use js file's path in stat.json#1506
stormslowly merged 2 commits intomasterfrom
fix/state_map_wrong_path

Conversation

@stormslowly
Copy link
Copy Markdown
Contributor

@stormslowly stormslowly commented Aug 19, 2024

problem

    AssetsInfo {
        assets_type: "asset",
        size: 8986250,
        name: "index.js.map",
        hashname: "index.b05c1236.js.map",
        chunk_id: "src/index.tsx",
        path: "/Users/mako/examples/with-antd/dist/index.b05c1236.js",
    },

the path field shoud be xxx.hash.js.map

and no more mod.rs

Summary by CodeRabbit

  • 新特性
    • 改进了源映射文件路径的生成逻辑,增强了资产管理的鲁棒性。

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Aug 19, 2024

Walkthrough

此次修改优化了emit_chunk_file函数中的源映射文件路径生成逻辑。引入了新的变量source_map_file_path,通过上下文配置构建源映射文件路径,替代了之前直接使用的字符串处理方式,提升了路径生成的准确性和鲁棒性。

Changes

文件 更改摘要
crates/mako/src/generate.rs 优化emit_chunk_file函数,新增source_map_file_path以改进源映射文件路径生成逻辑。
crates/mako/src/generate/mod.rs 优化emit_chunk_file函数,新增source_map_file_path以改进源映射文件路径生成逻辑。

Poem

在兔子的乐园里,路径变得明亮,
源映射的故事,如今更动听响。
先前的混乱,已被智慧驱散,
让我们欢庆这变化,兔子跃起欢畅! 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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
Copy Markdown

@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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ae37765 and 2934b62.

Files selected for processing (1)
  • crates/mako/src/generate/mod.rs (1 hunks)
Additional comments not posted (1)
crates/mako/src/generate/mod.rs (1)

570-579: 更改路径处理逻辑

引入的 source_map_file_path 变量用于存储 source map 文件的路径,并传递给 stats_info.add_assets。这符合 PR 的目标,确保 stat.json 中的路径字段正确反映 source map 文件的位置。

Copy link
Copy Markdown

@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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 2934b62 and a6c2e4f.

Files selected for processing (1)
  • crates/mako/src/generate.rs (1 hunks)
Additional comments not posted (1)
crates/mako/src/generate.rs (1)

569-579: 改进了 source_map_file_path 的构建方式

这段代码通过 context.config.output.pathchunk_file.source_map_disk_name() 来构建 source_map_file_path,确保了 source map 文件路径的正确性。这一改动提高了资产信息的准确性,符合 PR 的目标。

@stormslowly stormslowly merged commit 4e8892e into master Aug 20, 2024
@stormslowly stormslowly deleted the fix/state_map_wrong_path branch August 20, 2024 02:38
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.

1 participant