gpt4 book ai didi

node.js - NextJS模块解析失败: Unexpected character '@' (7:0)

转载 作者:太空宇宙 更新时间:2023-11-03 23:51:08 37 4
gpt4 key购买 nike

[ error ] ./node_modules/font-awesome/css/font-awesome.css 7:0
Module parse failed: Unexpected character '@' (7:0)
You may need an appropriate loader to handle this file type, currently no loaders are
configured to process this file. See https://webpack.js.org/concepts#loaders
| /* FONT PATH
| * -------------------------- */
> @font-face {
| font-family: 'FontAwesome';
| src: url('../fonts/fontawesome-webfont.eot?v=4.7.0');

我已经安装了 next-css,我的 next.config.json 是:

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

最佳答案

来自https://github.com/zeit/next-plugins/issues/432 :

将 next-css 与 url-loader、file-loader 和 css-loader 以及 next.config.json 一起安装可以解决这个问题。

const withCSS = require('@zeit/next-css')

module.exports = withCSS({
webpack: function (config) {
config.module.rules.push({
test: /\.(eot|woff|woff2|ttf|svg|png|jpg|gif)$/,
use: {
loader: 'url-loader',
options: {
limit: 100000,
name: '[name].[ext]'
}
}
})
return config
}
})

我还有名为 .next.config.json :P 的 next.config.json 文件,因此使用 next.config.json 时,错误应该是 ModuleParseError: Module parse failed: Unexpected character ' ' (1:0)

关于node.js - NextJS模块解析失败: Unexpected character '@' (7:0),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59455259/

37 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com