next.js 我试过用香草精,但不适合

zdwk9cvp  于 2023-10-18  发布在  其他
关注(0)|答案(1)|浏览(109)

我试过用香草精,但不适合

next.js.js

import { createVanillaExtractPlugin } from '@vanilla-extract/next-plugin';
const withVanillaExtract = createVanillaExtractPlugin();

/\*\* @type {import('next').NextConfig} \*/
const nextConfig = {};

export default withVanillaExtract(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": {
"@types/node": "20.5.9",
"@types/react": "18.2.21",
"@types/react-dom": "18.2.7",
"@vanilla-extract/css": "^1.13.0",
"@vanilla-extract/next-plugin": "^2.3.0",
"eslint": "8.48.0",
"eslint-config-next": "13.4.19",
"next": "13.4.19",
"react": "18.2.0",
"react-dom": "18.2.0",
"typescript": "5.2.2"
}
}

/src/app/page.tsx

import * as styles from './page.css'

export default function Home() {
return (
<main>
<div className={styles.page}>page</div>
</main>
)
}

/src/app/page.css.ts

import { style } from '@vanilla-extract/css'

export const page = style({
padding: 50
})

export const text = style({
color: 'red'
})

我试着在next 13中设置vanilla-extract,但没有错误,样式也没有应用。我该怎么办?

uqjltbpv

uqjltbpv1#

如果你的操作系统是Windows,它可能不会工作。在wsl 2中尝试

相关问题