-
Notifications
You must be signed in to change notification settings - Fork 408
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
feat: add sourcemap for all plugins #1380
Conversation
WalkthroughThe Vite build configuration files across numerous packages were updated to enable source map generation by adding Changes
Poem
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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 (likesourcemap: 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
Addingsourcemap: true
underbuild
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
Includingsourcemap: 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
Addingsourcemap: 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 (likesourcemap: true
) into a central config to keep each package’s config DRY.packages/toolbars/refresh/vite.config.ts (1)
25-25
: LGTM: Sourcemap correctly enabledSourcemap 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
📒 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
Addingsourcemap: true
under thebuild
configuration ensures source maps are emitted for thecommon
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 ofsourcemap: true
underbuild
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
Includingsourcemap: true
underbuild
ensures source maps are generated for theLowcodeDesignI18nHost
library, aiding development and troubleshooting.packages/configurator/vite.config.ts (1)
23-23
: Enable source map generation for configurator
Addingsourcemap: true
underbuild
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
Thesourcemap: true
option underbuild
enables source map output for theplugin-robot
package, making it easier to debug the compiled code.packages/toolbars/setting/vite.config.ts (1)
25-25
: LGTM: Sourcemap correctly enabledAdding 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 pluginEnabling 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 enabledThe 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
Addingsourcemap: true
under thebuild
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
Thesourcemap: true
flag is properly placed in thebuild
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
Includingsourcemap: true
underbuild
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 ofsourcemap: 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
Settingsourcemap: true
under thebuild
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 packageAdding
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 packageAdding
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 packageAdding
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 packageAdding
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: truePlease 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 debuggingAdding 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 debuggingEnabling 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 debuggingAdding 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 debuggingEnabling 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-scriptAdding 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-registerAdding 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-langSource 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 5Length 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.jsonLength 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 5Length of output: 804
Source map setting confirmed in Vite config, manual build verification required
The
sourcemap: true
option is correctly added under thebuild
block inpackages/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 capabilitiesThe 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 updateAdding
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 debuggingThe 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 patternThe 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.
English | 简体中文
PR
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
Background and solution
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information
Summary by CodeRabbit