Skip to content

fix(stacks-svelte): pre-bundle dayjs plugins with .js extension to fix CI test flake#2224

Merged
dancormier merged 3 commits intobetafrom
fix/svelte-test-dayjs-optimizedeps
Apr 1, 2026
Merged

fix(stacks-svelte): pre-bundle dayjs plugins with .js extension to fix CI test flake#2224
dancormier merged 3 commits intobetafrom
fix/svelte-test-dayjs-optimizedeps

Conversation

@dancormier
Copy link
Copy Markdown
Contributor

Summary

  • stacks-utils/src/DateTimeFormatter.ts imports dayjs/plugin/relativeTime.js and dayjs/plugin/updateLocale.js with explicit .js extensions
  • vite.config.ts listed these in optimizeDeps.include without the .js suffix, so Vite didn't recognise them as pre-bundled
  • On a cold cache (every CI run), Vite discovered the .js-suffixed variants mid-test, triggered a re-optimisation + server reload, and killed the in-flight Navigation test module fetch — causing TypeError: Failed to fetch dynamically imported module
  • Locally the cache persists between runs so the issue never surfaces

Fix: add dayjs/plugin/relativeTime.js and dayjs/plugin/updateLocale.js alongside the existing entries so both forms are pre-bundled before tests start.

Test plan

  • CI Unit Tests (stacks-svelte) job passes on this branch
  • No ✨ optimized dependencies changed. reloading in the test runner output
  • All 36 test files / 554+ tests pass

🤖 Generated with Claude Code

…timizeDeps

stacks-utils imports dayjs/plugin/relativeTime.js and updateLocale.js
with explicit .js extensions. Vite's optimizeDeps.include entries without
.js don't match these, so Vite discovers them as new deps mid-test run,
triggers re-optimization + reload, and kills in-flight test module fetches
(manifesting as a Navigation test import failure in CI).

CI always has a cold Vite cache; locally the .js variants get cached on the
first run, masking the issue.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 31, 2026

🦋 Changeset detected

Latest commit: 902ba40

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 31, 2026

Deploy Preview for stacks ready!

Name Link
🔨 Latest commit 902ba40
🔍 Latest deploy log https://app.netlify.com/projects/stacks/deploys/69cd891b913b5b00096c1a14
😎 Deploy Preview https://deploy-preview-2224--stacks.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 31, 2026

Deploy Preview for stacks-svelte ready!

Name Link
🔨 Latest commit 902ba40
🔍 Latest deploy log https://app.netlify.com/projects/stacks-svelte/deploys/69cd891b9a34030008e38a95
😎 Deploy Preview https://deploy-preview-2224--stacks-svelte.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@dancormier dancormier closed this Mar 31, 2026
@dancormier dancormier reopened this Mar 31, 2026
@dancormier dancormier changed the base branch from develop to beta March 31, 2026 21:06
dancormier and others added 2 commits April 1, 2026 17:04
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dancormier dancormier merged commit 051f747 into beta Apr 1, 2026
22 checks passed
@dancormier dancormier deleted the fix/svelte-test-dayjs-optimizedeps branch April 1, 2026 21:56
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