본문 바로가기
TroubleShooting

[ style X ] Error:stylex.create should never be called. It should be compiled away.

by ウリ김영은 2024. 1. 4.

//next.config.js

import StylexPlugin from '@stylexjs/nextjs-plugin';
import path from "path";

const nextConfig = {
  experimental: {
    forceSwcTransforms: true,
  },
  async rewrites (){
    return [
      {
        source:'/home',
        destination:'/'
      }
    ]
    } 
}

const __dirname = path.resolve();

export default StylexPlugin({
  filename: 'stylex-bundle.css',
  rootDir: __dirname,
  useCSSLayers: true,
})(nextConfig);

 

//package.json

{
	"name": "my-app",
	"version": "0.1.0",
	"private": true,
	"type": "module",
	"scripts": {
		"dev": "next dev",
		"build": "next build",
		"start": "next start",
		"lint": "next lint"
	},
	"dependencies": {
		"@stylexjs/stylex": "^0.4.1",
		"next": "14.0.4",
		"react": "^18",
		"react-dom": "^18"
	},
	"devDependencies": {
		"@stylexjs/babel-plugin": "^0.4.1",
		"@stylexjs/dev-runtime": "^0.4.1",
		"@stylexjs/eslint-plugin": "^0.4.1",
		"@stylexjs/nextjs-plugin": "^0.4.1",
		"@types/node": "^20",
		"@types/react": "^18",
		"@types/react-dom": "^18",
		"@typescript-eslint/parser": "^6.17.0",
		"eslint": "^8",
		"eslint-config-next": "14.0.4",
		"typescript": "^5.3.3"
	}
}

'TroubleShooting' 카테고리의 다른 글

환경변수가 안 불러와진다?  (0) 2024.01.19
[ Next.js ] Error: next-image-unconfigured-host  (0) 2024.01.08
[ Emotion ] props 넘겨줄 때 타입 에러  (0) 2023.12.16
Hydration  (0) 2023.10.26
Error: 를 어떻게 [ERROR] 로?  (0) 2023.10.22