fix(components): declare component modules as side-effectful#48
Merged
Conversation
- add **/components/** to the sideEffects package.json field so bundlers don't tree-shake customElements.define() calls out of the bundle - use import.meta.env.DEV directly instead of aliasing import.meta so build tools can statically strip it
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses bundler tree-shaking regressions introduced by the Vite v8 (Rolldown) upgrade by ensuring Web Component registration modules are treated as side-effectful and by adjusting dev-tools environment detection to enable build-time stripping in Vite-based consumers.
Changes:
- Expanded
package.json#sideEffectsto include component modules (**/components/**) socustomElements.define()registrations aren’t tree-shaken away. - Updated dev-tools development-mode detection logic to reference
import.meta.env.DEVdirectly.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/components/dev-tools/dev-tools.ts |
Adjusts dev-mode detection logic used by the dev-tools custom element. |
package.json |
Extends sideEffects patterns to retain component modules during bundler optimizations. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- this package ships plain tsc output with no Vite transform, so a direct import.meta.env.DEV reference throws in non-Vite consumers where env is undefined
salmanfarisvp
approved these changes
Jul 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
customElements.define()call forapp-header,auto-scaler,edge-app-devtools,brand-logo, and the calendar-view components, sincepackage.json'ssideEffectsfield didn't cover the component files. Adding**/components/**keeps them from being stripped.dev-tools.tsaliasedimport.metathrough a local variable, which hid it from Vite's staticimport.meta.envreplacement. Usingimport.meta.env.DEVdirectly lets it be stripped at build time instead of leaking a rawimport.metainto consumer bundles.Test plan
npm run build/npm run testlint,format,build,test, andscreenshotsall pass, and the previously-missing header/logo render correctly again across all screenshot resolutions