Skip to content

feat: add sourcemap for all plugins #1380

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 13, 2025

Conversation

chilingling
Copy link
Member

@chilingling chilingling commented May 12, 2025

English | 简体中文

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • Built its own designer, fully self-validated

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

Background and solution

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • Chores
    • Enabled source map generation across multiple packages to facilitate easier debugging and improved traceability of compiled code. No changes to public interfaces or exported entities.

Copy link
Contributor

coderabbitai bot commented May 12, 2025

Walkthrough

The Vite build configuration files across numerous packages were updated to enable source map generation by adding sourcemap: true under the build section. This adjustment was applied uniformly and does not affect exported or public entities, nor does it alter any other build or plugin settings.

Changes

File(s) Change Summary
packages/block-compiler/vite.config.ts
packages/builtinComponent/vite.config.ts
packages/canvas/vite.config.ts
packages/common/vite.config.ts
packages/configurator/vite.config.ts
packages/i18n/vite.config.ts
packages/layout/vite.config.ts
packages/register/vite.config.ts
packages/svgs/vite.config.ts
packages/utils/vite.config.ts
packages/webcomponent/vite.config.js
Added sourcemap: true under the build section to enable source map generation.
packages/plugins/i18n/vite.config.ts
packages/plugins/materials/vite.config.ts
packages/plugins/page/vite.config.ts
packages/plugins/robot/vite.config.ts
packages/plugins/schema/vite.config.ts
packages/plugins/script/vite.config.ts
packages/plugins/state/vite.config.ts
packages/plugins/tree/vite.config.ts
packages/plugins/tutorial/vite.config.ts
Enabled source map generation by adding sourcemap: true to the build options.
packages/settings/design/vite.config.ts
packages/settings/events/vite.config.ts
packages/settings/panel/vite.config.ts
packages/settings/props/vite.config.ts
packages/settings/styles/vite.config.ts
Modified build configuration to add sourcemap: true for source map generation.
packages/theme/base/vite.config.ts Added sourcemap: true under the build configuration for source map generation.
packages/toolbars/breadcrumb/vite.config.ts
packages/toolbars/clean/vite.config.ts
packages/toolbars/collaboration/vite.config.ts
packages/toolbars/fullscreen/vite.config.ts
packages/toolbars/generate-code/vite.config.ts
packages/toolbars/lang/vite.config.ts
packages/toolbars/lock/vite.config.ts
packages/toolbars/logo/vite.config.ts
packages/toolbars/logout/vite.config.ts
packages/toolbars/media/vite.config.ts
packages/toolbars/preview/vite.config.ts
packages/toolbars/redoundo/vite.config.ts
packages/toolbars/refresh/vite.config.ts
packages/toolbars/save/vite.config.ts
packages/toolbars/setting/vite.config.ts
packages/toolbars/themeSwitch/vite.config.ts
packages/toolbars/view-setting/vite.config.ts
Enabled source map generation by adding sourcemap: true under the build section.

Poem

In every config, a line appears,
sourcemap: true—the change is clear!
Now when we hop through code at night,
Debugging paths are mapped just right.
With trails revealed and bugs in view,
This bunny cheers: “Source maps—woohoo!”
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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.

@github-actions github-actions bot added the enhancement New feature or request label May 12, 2025
Copy link
Contributor

@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

🧹 Nitpick comments (6)
packages/toolbars/breadcrumb/vite.config.ts (1)

25-25: Enable source maps for improved debugging
This addition ensures Vite emits source maps during the build, aiding debugging and mapping errors back to the original source.
Consider extracting common build options (like sourcemap: true) into a shared base config to reduce repetition across packages.

packages/settings/styles/vite.config.ts (1)

25-25: Enable source maps for improved debugging
Adding sourcemap: true under build will help trace issues back to the original TypeScript and Vue source code.
Since this change is mirrored across many packages, you could centralize shared Vite build settings in a reusable config file to avoid duplication.

packages/toolbars/fullscreen/vite.config.ts (1)

25-25: Enable source maps for improved debugging
This setting directs Vite to generate source maps for the fullscreen toolbar bundle, which is essential for effective debugging.
To DRY up the repository, consider moving common build options (e.g., sourcemap: true) into a shared configuration module.

packages/plugins/tutorial/vite.config.ts (1)

25-25: Enable source maps for improved debugging
Including sourcemap: true will produce source maps for the tutorial plugin bundle, making it easier to correlate errors with original code.
Given the repeated pattern, a shared Vite config for common build options could reduce boilerplate across plugin configs.

packages/block-compiler/vite.config.ts (1)

28-28: Enable source maps for improved debugging
Adding sourcemap: true to the block-compiler build config ensures the generated bundle includes source maps, aiding in tracing issues in the compiled output.
You may want to consolidate repeated Vite build settings (like sourcemap: true) into a central config to keep each package’s config DRY.

packages/toolbars/refresh/vite.config.ts (1)

25-25: LGTM: Sourcemap correctly enabled

Sourcemap is properly configured. As a future enhancement, consider making sourcemap generation environment-dependent (enabled in development, disabled or external in production) to optimize production builds.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between f693484 and 3c6c43d.

📒 Files selected for processing (43)
  • packages/block-compiler/vite.config.ts (1 hunks)
  • packages/builtinComponent/vite.config.ts (1 hunks)
  • packages/canvas/vite.config.ts (1 hunks)
  • packages/common/vite.config.ts (1 hunks)
  • packages/configurator/vite.config.ts (1 hunks)
  • packages/i18n/vite.config.ts (1 hunks)
  • packages/layout/vite.config.ts (1 hunks)
  • packages/plugins/i18n/vite.config.ts (1 hunks)
  • packages/plugins/materials/vite.config.ts (1 hunks)
  • packages/plugins/page/vite.config.ts (1 hunks)
  • packages/plugins/robot/vite.config.ts (1 hunks)
  • packages/plugins/schema/vite.config.ts (1 hunks)
  • packages/plugins/script/vite.config.ts (1 hunks)
  • packages/plugins/state/vite.config.ts (1 hunks)
  • packages/plugins/tree/vite.config.ts (1 hunks)
  • packages/plugins/tutorial/vite.config.ts (1 hunks)
  • packages/register/vite.config.ts (1 hunks)
  • packages/settings/design/vite.config.ts (1 hunks)
  • packages/settings/events/vite.config.ts (1 hunks)
  • packages/settings/panel/vite.config.ts (1 hunks)
  • packages/settings/props/vite.config.ts (1 hunks)
  • packages/settings/styles/vite.config.ts (1 hunks)
  • packages/svgs/vite.config.ts (1 hunks)
  • packages/theme/base/vite.config.ts (1 hunks)
  • packages/toolbars/breadcrumb/vite.config.ts (1 hunks)
  • packages/toolbars/clean/vite.config.ts (1 hunks)
  • packages/toolbars/collaboration/vite.config.ts (1 hunks)
  • packages/toolbars/fullscreen/vite.config.ts (1 hunks)
  • packages/toolbars/generate-code/vite.config.ts (1 hunks)
  • packages/toolbars/lang/vite.config.ts (1 hunks)
  • packages/toolbars/lock/vite.config.ts (1 hunks)
  • packages/toolbars/logo/vite.config.ts (1 hunks)
  • packages/toolbars/logout/vite.config.ts (1 hunks)
  • packages/toolbars/media/vite.config.ts (1 hunks)
  • packages/toolbars/preview/vite.config.ts (1 hunks)
  • packages/toolbars/redoundo/vite.config.ts (1 hunks)
  • packages/toolbars/refresh/vite.config.ts (1 hunks)
  • packages/toolbars/save/vite.config.ts (1 hunks)
  • packages/toolbars/setting/vite.config.ts (1 hunks)
  • packages/toolbars/themeSwitch/vite.config.ts (1 hunks)
  • packages/toolbars/view-setting/vite.config.ts (1 hunks)
  • packages/utils/vite.config.ts (1 hunks)
  • packages/webcomponent/vite.config.js (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: push-check
🔇 Additional comments (37)
packages/common/vite.config.ts (1)

56-56: Enable source map generation for build
Adding sourcemap: true under the build configuration ensures source maps are emitted for the common package, improving debuggability and traceability of original source code.

packages/webcomponent/vite.config.js (1)

22-22: Enable source map generation for webcomponent
The addition of sourcemap: true under build will produce source maps for the webcomponent package, facilitating easier debugging of both ES and UMD builds.

packages/i18n/vite.config.ts (1)

28-28: Enable source map generation for i18n host
Including sourcemap: true under build ensures source maps are generated for the LowcodeDesignI18nHost library, aiding development and troubleshooting.

packages/configurator/vite.config.ts (1)

23-23: Enable source map generation for configurator
Adding sourcemap: true under build allows generation of source maps for the configurator package, aligning its build output with other modules and improving traceability.

packages/plugins/robot/vite.config.ts (1)

25-25: Enable source map generation for plugin-robot
The sourcemap: true option under build enables source map output for the plugin-robot package, making it easier to debug the compiled code.

packages/toolbars/setting/vite.config.ts (1)

25-25: LGTM: Sourcemap correctly enabled

Adding sourcemap generation is beneficial for debugging and will help developers track issues back to the original source code rather than having to debug in the minified/bundled output.

packages/plugins/i18n/vite.config.ts (1)

25-25: LGTM: Sourcemap correctly enabled for i18n plugin

Enabling sourcemaps for the i18n plugin is especially valuable since internationalization code often involves string transformations and dynamic content that can be difficult to debug without proper source mapping.

packages/toolbars/logout/vite.config.ts (1)

25-25: LGTM: Sourcemap consistently enabled

The sourcemap configuration is properly added and maintains consistency with the project-wide implementation. This ensures a uniform debugging experience across all toolbar components.

packages/toolbars/save/vite.config.ts (1)

25-25: Enable source map generation
Adding sourcemap: true under the build section is correct and consistent with the goal of producing source maps for debugging across all plugins.

packages/plugins/schema/vite.config.ts (1)

25-25: Enable source map generation
The sourcemap: true flag is properly placed in the build configuration to emit source maps for this plugin, aligning with other packages.

packages/settings/panel/vite.config.ts (1)

25-25: Enable source map generation
Including sourcemap: true under build will ensure that source maps are generated for the settings panel package, improving traceability during development.

packages/toolbars/generate-code/vite.config.ts (1)

25-25: Enable source map generation
The addition of sourcemap: true is appropriate here to produce source maps for the generate-code toolbar module, matching the project standard.

packages/toolbars/redoundo/vite.config.ts (1)

25-25: Enable source map generation
Setting sourcemap: true under the build block correctly activates source map output for the redoundo toolbar, aligning with other plugin configs.

packages/toolbars/themeSwitch/vite.config.ts (1)

25-25: Enabling source maps for themeSwitch toolbar package

Adding sourcemap: true to the build configuration will generate source maps during the build process, which will help with debugging by mapping the compiled code back to the original source. This change aligns well with the PR objective to add source maps for all plugins.

packages/plugins/state/vite.config.ts (1)

25-25: Enabling source maps for state plugin package

Adding sourcemap: true to the build configuration will generate source maps during the build process, which will help with debugging by mapping the compiled code back to the original source. This change aligns well with the PR objective to add source maps for all plugins.

packages/toolbars/lock/vite.config.ts (1)

25-25: Enabling source maps for lock toolbar package

Adding sourcemap: true to the build configuration will generate source maps during the build process, which will help with debugging by mapping the compiled code back to the original source. This change aligns well with the PR objective to add source maps for all plugins.

packages/layout/vite.config.ts (1)

25-25: Enabling source maps for layout package

Adding sourcemap: true to the build configuration will generate source maps during the build process, which will help with debugging by mapping the compiled code back to the original source. This change aligns well with the PR objective to add source maps for all plugins.

packages/plugins/page/vite.config.ts (1)

25-25: LGTM: Source map generation enabled.

Adding source maps is a good improvement that will help with debugging by mapping transpiled/bundled code back to the original source.

packages/settings/events/vite.config.ts (1)

25-25: LGTM: Source map generation properly configured.

The addition of source maps follows the same pattern applied to other packages and will improve debugging capabilities.

packages/toolbars/collaboration/vite.config.ts (1)

24-24: LGTM: Source map enabled consistently.

The source map configuration is correctly applied, maintaining consistency with other package configurations.

packages/toolbars/view-setting/vite.config.ts (1)

25-25:

❓ Verification inconclusive

LGTM: Source map generation added appropriately.

The source map generation is correctly configured. This change completes the consistent implementation across all packages.

Consider checking if there are any build performance implications from enabling source maps for all packages. While source maps are invaluable for debugging, they do increase build output size. You might want to verify this is the desired behavior for both development and production environments:


🏁 Script executed:

#!/bin/bash
# Check for any existing configuration that might control source map generation in production builds
grep -r "sourcemap" --include="*.js" --include="*.ts" --include="*.json" .

Length of output: 31884


Verify environment-specific source map configuration

I see that build/vite-config/src/default-config.js explicitly sets

sourcemap: false

while every package’s Vite config—including packages/toolbars/view-setting/vite.config.ts at line 25—now unconditionally overrides it to

sourcemap: true

This makes source maps part of all builds (dev and prod), which can increase bundle size and slow down CI pipelines.

• default-config.js: sourcemap: false
• view-setting (and all other packages): sourcemap: true

Please confirm that shipping source maps in production is intentional. If you only need them for development, consider toggling with an environment check, for example:

sourcemap: process.env.NODE_ENV !== 'production'
packages/toolbars/media/vite.config.ts (1)

25-25: Source map generation enabled for better debugging

Adding source map generation will improve the debugging experience by mapping the compiled code back to the original source, making it easier to identify and fix issues during development.

packages/utils/vite.config.ts (1)

21-21: Source map generation enabled for better debugging

Enabling source maps is beneficial for the utils package, which likely contains shared functionality used across the application. This will help track down bugs more efficiently when issues occur in these utility functions.

packages/toolbars/preview/vite.config.ts (1)

25-25: Source map generation enabled for better debugging

Adding source map support to the preview toolbar will make troubleshooting easier by preserving the original code structure in the compiled output. This is particularly valuable for complex UI components like toolbars.

packages/settings/props/vite.config.ts (1)

25-25: Source map generation enabled for better debugging

Enabling source maps for the props settings package aligns with the repository-wide effort to improve debugging capabilities. This consistent approach across all packages will provide a better developer experience.

packages/plugins/script/vite.config.ts (1)

25-25: Source map generation enabled for plugin-script

Adding source maps will improve debugging capability by providing accurate mapping between compiled code and original source. This is particularly valuable for complex plugins where debugging would otherwise be challenging.

packages/register/vite.config.ts (1)

22-22: Source map generation enabled for meta-register

Adding source maps correctly configured in the build options. This maintains debugging capabilities consistent with other packages in the project.

packages/toolbars/lang/vite.config.ts (1)

25-25: Source map generation enabled for toolbar-lang

Source map configuration correctly applied to the lang toolbar component. This change maintains consistency with the project-wide effort to improve debugging capabilities.

packages/toolbars/logo/vite.config.ts (1)

25-25:

❓ Verification inconclusive

Source map generation enabled for toolbar-logo

Source map configuration correctly applied. This completes the consistent implementation across toolbar components.

You may want to verify that source maps are correctly generated in the build output by running a build and checking for .map files in the output directory.


🏁 Script executed:

#!/bin/bash
# Check if source maps are being generated for a sample of packages
echo "Checking for source map generation in build output..."
npm run build
echo "Searching for .map files in dist directories..."
find packages -path "*/dist/*.map" -type f | head -n 5

Length of output: 516


🏁 Script executed:

#!/bin/bash
# Display root package.json to inspect available scripts and workspaces
cat package.json

# Display package.json for the toolbar-logo package to inspect its build script
cat packages/toolbars/logo/package.json

Length of output: 3783


🏁 Script executed:

#!/bin/bash
# Build only the toolbar-logo package using pnpm
echo "Building @opentiny/tiny-engine-toolbar-logo..."
pnpm --filter @opentiny/tiny-engine-toolbar-logo run build

# Check for generated source map files in its dist directory
echo "Checking for .map files in packages/toolbars/logo/dist..."
find packages/toolbars/logo/dist -type f -name '*.map' | head -n 5

Length of output: 804


Source map setting confirmed in Vite config, manual build verification required

The sourcemap: true option is correctly added under the build block in packages/toolbars/logo/vite.config.ts, matching the setup in the other toolbar packages. No code changes are needed here.

Please verify locally that the source maps are actually emitted:

  • Run pnpm install at the repo root.
  • Build the logo package:
    pnpm --filter @opentiny/tiny-engine-toolbar-logo run build
  • Inspect the output directory for .map files:
    find packages/toolbars/logo/dist -type f -name '*.map'
packages/toolbars/clean/vite.config.ts (1)

25-25: Good addition of source map support!

Adding sourcemap: true to the build configuration will generate source maps for this package, which will greatly improve debugging by mapping compiled code back to the original source. This is valuable for development and troubleshooting production issues.

packages/canvas/vite.config.ts (1)

34-34: Good addition of source maps for the canvas package!

Enabling source maps is particularly valuable for this package given its complexity with multiple entry points and custom chunk handling. This will significantly improve debugging experience by providing accurate mapping between compiled code and original source.

packages/svgs/vite.config.ts (1)

25-25: Good addition of source map generation!

Adding source maps to the SVG package will enhance debugging capabilities, making it easier to trace issues in both JavaScript and potentially in the CSS handling. This is a beneficial change with no drawbacks.

packages/plugins/materials/vite.config.ts (1)

25-25: Good addition of source maps to the materials plugin!

Adding source map support to this plugin aligns with the PR objective to add source maps for all plugins. This will improve debugging capabilities by allowing developers to see the original source code when inspecting compiled code during development or troubleshooting.

packages/plugins/tree/vite.config.ts (1)

25-25: Enabling source maps improves debugging capabilities

The addition of sourcemap: true to the build configuration is a good practice that will help developers debug issues by mapping compiled code back to the original source files.

packages/builtinComponent/vite.config.ts (1)

22-22: Source map enablement consistent with project-wide update

Adding sourcemap: true is appropriate and aligns with the PR's goal of adding source maps for all plugins. This will be particularly helpful for debugging this component.

packages/theme/base/vite.config.ts (1)

20-20: Source map addition will aid in theme debugging

The addition of sourcemap: true for this theme package is beneficial and consistent with the changes in other packages. This will be especially useful for debugging styling issues.

packages/settings/design/vite.config.ts (1)

24-24: Source map implementation follows consistent pattern

The addition of sourcemap: true here matches the pattern established in other packages and will allow for better debugging of the settings design module.

Consider adding a note in the PR description about the potential increase in build size due to source map generation. While this is great for development, you might want to ensure source maps are not included in production builds if bundle size is a concern.

@hexqi hexqi merged commit da36e49 into opentiny:develop May 13, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants