Skip to content

Commit c84d6cd

Browse files
committed
[chore] Use unplugin for docs website
1 parent c5bf938 commit c84d6cd

File tree

4 files changed

+33
-121
lines changed

4 files changed

+33
-121
lines changed

package-lock.json

Lines changed: 1 addition & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/docs/docusaurus.config.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
// @ts-check
1010
// Note: type annotations allow type checking and IDEs autocompletion
1111

12+
const stylexPlugin = require('@stylexjs/unplugin').default;
13+
1214
/** @type {import('@docusaurus/types').Config} */
1315
const config = {
1416
title: 'StyleX',
@@ -206,4 +208,32 @@ const config = {
206208
},
207209
};
208210

211+
const rootDir = __dirname;
212+
213+
config.plugins = [
214+
function stylexUnplugin() {
215+
return {
216+
name: 'stylex-unplugin',
217+
configureWebpack(_config) {
218+
const isProd = process.env.NODE_ENV === 'production';
219+
return {
220+
plugins: isProd
221+
? [
222+
stylexPlugin.webpack({
223+
dev: !isProd,
224+
runtimeInjection: false,
225+
stylexSheetName: '<>',
226+
unstable_moduleResolution: {
227+
type: 'commonJS',
228+
rootDir,
229+
},
230+
}),
231+
]
232+
: [],
233+
};
234+
},
235+
};
236+
},
237+
];
238+
209239
module.exports = config;

packages/docs/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "docs",
44
"version": "0.17.0",
55
"scripts": {
6-
"build": "rimraf ./build ./docusaurus && cross-env NODE_ENV=production docusaurus build && node ./scripts/make-stylex-sheet.js",
6+
"build": "rimraf ./build ./docusaurus && cross-env NODE_ENV=production docusaurus build",
77
"clear": "docusaurus clear",
88
"lint": "eslint --cache \"**/*.js\" && stylelint \"**/*.css\"",
99
"serve": "docusaurus serve",
@@ -28,6 +28,7 @@
2828
},
2929
"devDependencies": {
3030
"@babel/eslint-parser": "^7.26.8",
31+
"@stylexjs/unplugin": "0.17.0",
3132
"@stylexjs/eslint-plugin": "0.17.0",
3233
"@stylexjs/babel-plugin": "0.17.0",
3334
"clean-css": "^5.3.2",
@@ -37,7 +38,6 @@
3738
"eslint-plugin-jsx-a11y": "^6.8.0",
3839
"eslint-plugin-react": "^7.30.1",
3940
"eslint-plugin-react-hooks": "^4.6.0",
40-
"mkdirp": "^1.0.4",
4141
"stylelint": "^14.9.1"
4242
},
4343
"browserslist": {

packages/docs/scripts/make-stylex-sheet.js

Lines changed: 0 additions & 107 deletions
This file was deleted.

0 commit comments

Comments
 (0)