Skip to content

Error using vite with RSD: stylex.create'should never be called at runtime. #265

Open
@carloslibardo

Description

Describe the issue

I created a react-ts app using vite cli to react-ts project, then add RSD library and follow setup steps.

When trying to render anything using RSD running vite command to run Vite Application this errors happens:

Uncaught Error: 'stylex.create' should never be called at runtime. It should be compiled away by '@stylexjs/babel-plugin'

Below this thread have more about discussion of this problem, possible Vite is not processing correctly RSD at runtime.

Expected behavior

Works a hello world project without any errors.

Steps to reproduce

1 - create react-ts app using vite: npm create vite@latest my-react-app -- --template react-ts
2 - add RSD into project
3 - make setup following the docs.
4 - try to render simple any DOM using RSD
5 - run yarn dev to run project

Test case

https://codesandbox.io/p/github/carloslibardo/website/main

Additional comments

Already tried to add "node_modules/react-strict-dom/dist/dom/runtime.js" into postcss.config.js and does not work, if i comment runtime.js stylex code it works, but still cannot apply my styles using stylex at my components.

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions