-
Hey! When I setup the stylex webpack plugin with docusaurus it works fine when running
I use the monorepo setup and the docusaurus is using the bundled components with stylex.create styles, then I'm importing it in some mdx doc like: // It's not path alias, using workspaces here
import { Button } from "@monorepo/ui";
<Button color="primary">Button</Button> Result: I added it to docusaurus plugins, like: plugins: [
// webpack plugin
async function stylexPlugin() {
return {
name: "docusaurus-stylex",
configureWebpack(configuration) {
configuration.plugins.unshift(
// Ensure that the stylex plugin is used before Babel
new StylexPlugin({
filename: "styles.[contenthash].css",
// get webpack mode and set value for dev
dev: configuration.mode === "development",
// Use statically generated CSS files and not runtime injected CSS.
// Even in development.
runtimeInjection: false,
// optional. default: 'x'
classNamePrefix: "x",
// Required for CSS variable support
unstable_moduleResolution: {
// type: 'commonJS' | 'haste'
// default: 'commonJS'
type: "commonJS",
// The absolute path to the root directory of your project
rootDir: path.join(__dirname, "../"), // path is correct 100%
},
}),
);
},
};
},
] Do you know what's going on here? Or how to make it work? Or any guidance? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Here's a project with docusaurus 3 that has been set up to work correctly. Although, build caching does not work. https://github.com/nmn/docusaurus-stylex Further improvements for Webpack are in the works. |
Beta Was this translation helpful? Give feedback.
Here's a project with docusaurus 3 that has been set up to work correctly. Although, build caching does not work.
https://github.com/nmn/docusaurus-stylex
Further improvements for Webpack are in the works.