Skip to content

Confusion Around "Libraries" Setting #94

@prests

Description

@prests

Hello!

I have some stylex themes that are being set on the the server side for my remix application. I noticed that moving the import of these themes to my entry.server.ts file has caused these classes to no longer be included in the final main.css file despite seeing the correct class names applied to the body tag.

I have tried adding the path to these themes to the libraries property but still don't see them included. Any advice would be greatly appreciated!

// vite.config.ts
    styleX({
      libraries: ['./src/remix-app/themes/light-theme.ts', './src/remix-app/themes/dark-theme.ts'],
    }),
// dark-theme.ts
const darkTheme = stylex.createTheme(tokens, {
  ...
});

export { darkTheme };
// light-theme.ts
const lightTheme = stylex.createTheme(tokens, {
  ...
});

export { lightTheme };
// entry.server.ts
import * as stylex from '@stylexjs/stylex';

import { darkTheme } from './themes/dark-theme';
import { lightTheme } from './themes/light-theme';

const theme = stylex.props(mode === LIGHT_MODE ? lightTheme : darkTheme).className;

....

`<body class=${theme}>`
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions