【问题标题】:next-css causing infinite compilingnext-css 导致无限编译
【发布时间】:2020-02-14 23:30:19
【问题描述】:

我已尝试按照the projects GitHub 上的说明进行操作。

按照上面所说的,我将 next.config.js 文件设置为以下内容;

const withCSS = require('@zeit/next-css');
module.exports = withCSS();

我还没有任何 NextJS 的自定义选项。

但是在我的Header Componen 我有以下内容:

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 中不会像文档中所说的那样生成任何内容。

任何帮助表示赞赏:)

【问题讨论】:

    标签: css reactjs webpack next.js css-loader


    【解决方案1】:

    你的导入应该是:

    import Head from "next/head";
    

    【讨论】:

    • 抱歉回复晚了,我已经测试过了。仍然没有解决编译问题:(
    猜你喜欢
    • 2018-10-15
    • 2018-01-02
    • 1970-01-01
    • 2019-12-03
    • 2014-10-22
    • 1970-01-01
    • 1970-01-01
    • 2020-12-04
    • 1970-01-01
    相关资源
    最近更新 更多