我已尝试按照 the projects GitHub 上给出的说明进行操作.
按照它所说的,我将我的 next.config.js 文件制作成以下内容;
const withCSS = require('@zeit/next-css');
module.exports = withCSS();
我还没有任何 NextJS 的自定义选项。
但是在我的 Header
组件中,我有以下内容:
import Head from "next";
import "../../test/css/bootstrap.min.css"
const Header = () => (
<Head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Test</title>
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport" />
</Head>
);
export default Header;
每当我尝试使用 import Header from "../components/layout/header"
访问页面时,输出就位于 [wait] compiling ...
并且从不移动。
在 .next/static/css
中没有像文档所说的那样生成任何东西。
感谢任何帮助:)
最佳答案
您的导入应该是:
import Head from "next/head";
关于css - next-css 导致无限编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58442865/