Skip to content

Commit

Permalink
chore: replace stylex configs with recommended
Browse files Browse the repository at this point in the history
  • Loading branch information
Floffah committed Jan 7, 2025
1 parent 34915b4 commit 4dc3acf
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 101 deletions.
26 changes: 21 additions & 5 deletions apps/web/next.config.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,33 @@
import stylexConfig from "./stylex.config";
import stylexPlugin from "@stylexswc/nextjs-plugin";
import type { NextConfig } from "next";
import path from "node:path";
import Icons from "unplugin-icons/webpack";

const withStylex = stylexPlugin(stylexConfig);
const projectRoot = __dirname;
// const monorepoRoot = path.resolve(projectRoot, "../../");

const withStylex = stylexPlugin({
rsOptions: {
aliases: {
"@/*": [path.join(projectRoot, "src/*")],
},
unstable_moduleResolution: {
type: "commonJS",
// rootDir: monorepoRoot,
},
},
extractCSS: false,
});

const nextConfig = {
reactStrictMode: true,
serverExternalPackages: ["@node-rs/bcrypt"],
transpilePackages: ["@stylexjs/open-props"],
experimental: {
// ppr: true,
},
typescript: {
// part of lint step, next ignores tsconfig references and breaks trpc
ignoreBuildErrors: true,
},
eslint: {
Expand All @@ -26,9 +45,6 @@ const nextConfig = {

return config;
},
images: {
remotePatterns: [],
},
} satisfies NextConfig;

export default withStylex(nextConfig);
20 changes: 18 additions & 2 deletions apps/web/postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
const path = require("path");

const projectRoot = __dirname;
const monorepoRoot = path.resolve(projectRoot, "../../");

module.exports = {
plugins: {
"@stylexswc/postcss-plugin": {
include: [projectRoot + "/src/**/*.{js,jsx,ts,tsx}"],
...require("./stylex.config"),
include: ["src/**/*.{js,jsx,ts,tsx}"],
rsOptions: {
isDev: process.env.NODE_ENV === "development",
genConditionalClasses: true,
treeshakeCompensation: true,
useRemForFontSize: true,
aliases: {
"@/*": [path.join(projectRoot, "src/*")],
},
unstable_moduleResolution: {
type: "commonJS",
rootDir: projectRoot,
},
},
useCSSLayers: true,
},
"postcss-preset-env": {},
},
Expand Down
25 changes: 0 additions & 25 deletions apps/web/stylex.config.js

This file was deleted.

Loading

0 comments on commit 4dc3acf

Please sign in to comment.