import * as React from "react";
import * as StyleX from "@stylexjs/stylex";
import * as Types from "./type";
const style = StyleX.create(
{
input:
{
border: "red solid 1px",
},
}
);
export function Component(props : Types.T_Props) : JSX.Element
{
return (
<input
{...StyleX.props(style.input)}
placeholder = {props.placeholder}
onChange = {HandleOnChange}
/>
);
};
error in the browser
Uncaught Error: 'stylex.create' should never be called at runtime. It should be compiled away by '@stylexjs/babel-plugin'
errorForFn webpack://employee_react/./node_modules/@stylexjs/stylex/lib/stylex.js?:12
stylexCreate webpack://employee_react/./node_modules/@stylexjs/stylex/lib/stylex.js?:51
Describe the issue
I try to use StyleX in a react Typescript project using webpack to bundle all this.When I try to run my code I got this same error.
Expected behavior
Use StyleX in my code and it should be compiled when I build my app.
Steps to reproduce
package.json
tsconfig.json
webpack.config.js
code example
error in the browser
Uncaught Error: 'stylex.create' should never be called at runtime. It should be compiled away by '@stylexjs/babel-plugin' errorForFn webpack://employee_react/./node_modules/@stylexjs/stylex/lib/stylex.js?:12 stylexCreate webpack://employee_react/./node_modules/@stylexjs/stylex/lib/stylex.js?:51