This guide helps you migrate from v5.8.3 to v5.8.4, which includes significant architectural changes to the Weaverse SDKs.
- ✅ Removed
@weaverse/shopifypackage (archived) - ✅ Removed Stitches CSS-in-JS library
- ✅ Removed
platformTypeproperty from core architecture - ✅ Simplified styling system to use className-based approach
- ✅ Updated TypeScript configuration for better path resolution
The @weaverse/shopify package has been archived and is no longer maintained. All files have been moved to archived/shopify/ for reference.
Replace @weaverse/shopify imports with @weaverse/hydrogen:
// ❌ Before (removed)
import { WeaverseShopify } from '@weaverse/shopify'
// ✅ After
import { WeaverseHydrogen } from '@weaverse/hydrogen'@weaverse/hydrogenis the modern, maintained package- Built on React Router v7
- Better TypeScript support
- Regular updates and bug fixes
The Stitches CSS-in-JS library has been completely removed from the Weaverse SDKs. This means:
- No more automatic CSS class generation
- No more dynamic inline styles
- Components now rely purely on className-based styling
WeaverseCSSPropertiesnow maps to React'sCSSProperties
# Remove from package.json
npm uninstall @stitches/coreBefore (Stitches-based):
// Components automatically generated CSS classes
const MyComponent = ({ data }) => {
return <div>Weaverse handled styling automatically</div>
}After (className-based):
// Components now use CSS classes
import styles from './MyComponent.module.css'
const MyComponent = ({ data }) => {
return <div className={styles.container}>Use CSS modules</div>
}Before (automatic inline styles):
// Weaverse automatically applied styles
const element = {
data: {
css: {
backgroundColor: 'red',
padding: '10px'
}
}
}After (manual styling):
// Option 1: CSS Modules with dynamic classes
import styles from './element.module.css'
const getElementClassName = (css) => {
return styles[css.variant] || styles.default
}
// Option 2: CSS-in-JS library (styled-components, emotion)
import styled from 'styled-components'
const StyledElement = styled.div`
background-color: ${(props) => props.backgroundColor || 'red'};
padding: ${(props) => props.padding || '10px'};
`Before:
import type { WeaverseCSSProperties } from '@weaverse/core'
// WeaverseCSSProperties had Stitches-specific propertiesAfter:
import type { CSSProperties } from 'react'
// Use React's built-in CSSProperties type
const styles: CSSProperties = {
backgroundColor: 'red',
padding: '10px'
}The platformType property has been removed from:
WeaverseCoreParamsWeaverseclassWeaverseHydrogenclass
Simply remove any platformType assignments:
// ❌ Before
const weaverse = new Weaverse({
platformType: 'shopify-hydrogen', // Removed
projectId: 'abc123',
data: projectData
})
class MyHydrogen extends WeaverseHydrogen {
platformType: 'shopify-hydrogen' = 'shopify-hydrogen' // Removed
}
// ✅ After
const weaverse = new Weaverse({
projectId: 'abc123',
data: projectData
// platformType no longer needed
})
class MyHydrogen extends WeaverseHydrogen {
// platformType property removed
}The platform-specific logic was simplified since all platforms now use the same rendering approach without platform-specific styling behavior.
With Stitches removal, automatic responsive styling (@mobile, @tablet) is no longer available through the Weaverse SDK.
/* MyComponent.module.css */
.container {
padding: 20px;
}
@media (max-width: 768px) {
.container {
padding: 10px;
}
}import styled from 'styled-components'
const ResponsiveContainer = styled.div`
padding: 20px;
@media (max-width: 768px) {
padding: 10px;
}
`.container {
--padding: 20px;
padding: var(--padding);
}
@media (max-width: 768px) {
.container {
--padding: 10px;
}
}- Root
tsconfig.jsonchangedmoduleResolutionfrom"bundler"to"node" - Added
typecheckscripts to individual packages - Added
include/excludepatterns to package tsconfig files
Update your project's TypeScript configuration if you extend from the Weaverse SDKs:
// Your project's tsconfig.json
{
"extends": "./node_modules/@weaverse/core/tsconfig.json",
"compilerOptions": {
"moduleResolution": "node", // Changed from bundler
"baseUrl": ".",
"paths": {
"~/*": ["./src/*"]
}
},
"include": ["src/**/*"], // Added include pattern
"exclude": ["dist", "node_modules"] // Added exclude pattern
}// Button/index.tsx
import styles from './Button.module.css'
export const Button = ({ children, variant = 'primary' }) => {
return (
<button className={`${styles.button} ${styles[variant]}`}>
{children}
</button>
)
}/* Button.module.css */
.button {
padding: 8px 16px;
border: none;
border-radius: 4px;
font-weight: 500;
}
.primary {
background-color: #007bff;
color: white;
}
.secondary {
background-color: #6c757d;
color: white;
}import styled from 'styled-components'
const Button = styled.button`
padding: 8px 16px;
border: none;
border-radius: 4px;
font-weight: 500;
background-color: ${({ variant = 'primary' }) =>
variant === 'primary' ? '#007bff' : '#6c757d'};
color: white;
`
export { Button }/** @jsxImportSource @emotion/react */
import { css } from '@emotion/react'
const buttonStyles = (variant = 'primary') => css`
padding: 8px 16px;
border: none;
border-radius: 4px;
font-weight: 500;
background-color: ${variant === 'primary' ? '#007bff' : '#6c757d'};
color: white;
`
export const Button = ({ children, variant = 'primary', ...props }) => (
<button css={buttonStyles(variant)} {...props}>
{children}
</button>
)Before:
export const HeroSection = ({ data }) => {
// Weaverse automatically handled styling
return (
<section>
<h1>{data.heading}</h1>
<p>{data.subheading}</p>
</section>
)
}After:
import styles from './HeroSection.module.css'
export const HeroSection = ({ data }) => {
return (
<section className={styles.hero}>
<h1 className={styles.heading}>{data.heading}</h1>
<p className={styles.subheading}>{data.subheading}</p>
</section>
)
}Before:
// Stitches automatically handled theme
const themedComponent = stitchesInstance.css({
backgroundColor: '$primaryColor',
color: '$textColor'
})After:
// Option 1: CSS Variables
const styles = css`
.component {
background-color: var(--primary-color);
color: var(--text-color);
}
`
// Option 2: Theme Provider
import { useTheme } from './ThemeContext'
const ThemedComponent = ({ children }) => {
const theme = useTheme()
const style = {
backgroundColor: theme.primaryColor,
color: theme.textColor
}
return <div style={style}>{children}</div>
}- Remove all
@stitches/coreimports - Replace Weaverse automatic styling with CSS classes
- Remove all
platformTypeproperties - Update TypeScript configuration
- Test responsive designs work correctly
- Verify dynamic styling still functions
- Check that all component styles load
- Run existing tests and fix any failures
Issue: Missing CSS classes
// Check that you're importing CSS modules
import styles from './Component.module.css' // ✅
// import './Component.css' // ❌Issue: TypeScript errors
// Update type imports
import type { CSSProperties } from 'react' // ✅
// import type { WeaverseCSSProperties } from '@weaverse/core' // ❌Issue: Build failures
# Clear build cache
rm -rf dist node_modules/.cache
npm run build- GitHub Issues: Report migration problems at Weaverse Issues
- Discord Community: Get help from other developers
- Documentation: Check updated Weaverse Documentation
If you need to maintain compatibility with old Stitches-based code:
- Gradual Migration: Migrate components one at a time
- Wrapper Components: Create compatibility layers
- Feature Flags: Use feature flags to switch between old and new implementations
These changes simplify the Weaverse SDK architecture and provide better developer experience:
- ✅ Cleaner API: No more platform-specific logic
- ✅ Better TypeScript: Improved type safety and resolution
- ✅ Standard Tools: Use familiar CSS and React patterns
- ✅ Future-Proof: Easier to maintain and extend
While these are breaking changes, the migration path is straightforward and results in more maintainable code. Take advantage of this opportunity to improve your component styling architecture!
Version: v5.8.4 Last Updated: 2025-01-02 Compatible With: React 18+, TypeScript 5.0+