Skip to content
tezvyn:

Coexisting major versions during migration

Source: interviewHardHow cards are made

Summary

running two breaking versions side by side safely.

Key points

scoped aliases or namespaced packages, isolated token scopes, and incremental migration.

Watch out for

ignoring duplicated CSS, global token collisions, and bundle bloat.

What's really being asked

This checks whether you understand module resolution, CSS scoping, and the real cost of breaking changes. Protracted migrations are common in large apps, and naive upgrades cause subtle global conflicts.

The full answer

Explain that you can install two majors simultaneously using package aliases (ds-v1 pointing at version one and ds-v2 at version two) or by publishing each major under a distinct package name. Module resolution then keeps the two trees separate so imports are unambiguous. Critically, you must isolate anything global: scope CSS custom properties under different selectors, prefix or hash class names so styles do not bleed, and avoid shared singletons. Migrate incrementally, one route or feature at a time, validating visually as you go. Provide a clear deprecation timeline so the dual-install period ends.

The mistakes people make

Assuming a version bump alone is enough, ignoring that breaking changes are breaking. Forgetting that global CSS resets, font imports, or a shared design token sheet will collide between versions. Overlooking duplicated runtime context, where two copies of a provider mean components read the wrong one.

What usually comes next

How do you prevent two copies of React or a context provider from conflicting? How do you keep the visual inconsistency tolerable to users? How do you enforce that the dual period is temporary?

A concrete example

You alias @ds/core to v1 and @ds/core-next to v2 in package.json, wrap each region of the app in its own themed provider with namespaced token selectors, and migrate the settings area first. The pitfall surfaces immediately: the bundle grows because both component sets ship, and a global font reset from v2 leaks into v1 pages until you scope it. You accept the temporary bloat, fix the global leak, and set a hard removal date for v1.

Interview question

What is a primary risk of running two major versions of a component library in the same app at once?

  • a.Browsers refuse to load two CSS files from the same origin
  • b.Module resolution makes it impossible to import either version
  • c.TypeScript cannot compile a project that imports two package versions
  • d.Global tokens, CSS resets, and shared singletons from each version can collideCorrect
Why?

Isolation of global concerns is the hard part: unscoped tokens, resets, and shared context bleed between versions. Module resolution and TypeScript both handle multiple versions via aliasing, and browsers happily load multiple stylesheets.

Just read this? Test yourself on what you have been reading.

Read the original → uxpin.com

Put your scrolling time to good use

Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Open roles that interview on design-systems — each one lists the topics its interview covers.

See open roles