You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey, I've tried using stylexjs with app router and it works. but when i tried using it with pages router, Im getting an issue of stylex adding class names to the elements but not applying styles to those classes. heres the codes:
next.config.ts
importtype{NextConfig}from"next";importstylexPluginfrom"@stylexjs/nextjs-plugin";constnextConfig: NextConfig={/* config options here */pageExtensions: ['js','jsx','mdx','ts','tsx'],transpilePackages: ["@stylexjs/open-props"],};const__dirname=newURL(".",import.meta.url).pathname;exportdefaultstylexPlugin({rootDir: __dirname,})(nextConfig);
The @stylexjs/next-plugin is only tested to work on app/ directory. Please use a next project with a src directory and @stylexjs/cli instead for a more reliable experience. (We will also be improving the CLI further soon)
The CLI will work with app/orpages/ directory as long as it is in an src/ folder.
The process to use it is as follows:
Create new project with an src/ folder
Rename src/ to source/ instead
Update the tsconfig.json and .gitignore to ignore the src folder
Hey, I've tried using stylexjs with app router and it works. but when i tried using it with pages router, Im getting an issue of stylex adding class names to the elements but not applying styles to those classes. heres the codes:
next.config.ts
.babelrc.js
index.tsx
The text was updated successfully, but these errors were encountered: