首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何解决使用next.js导入css文件时出现的错误?

如何解决使用next.js导入css文件时出现的错误?
EN

Stack Overflow用户
提问于 2020-07-25 04:03:17
回答 2查看 112关注 0票数 1

错误:

代码语言:javascript
运行
复制
./node_modules/quill-emoji/dist/quill-emoji.css
ModuleParseError: Module parse failed: Unexpected character '�' (1: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
(Source code omitted for this binary file)

_app.js中,我有:

代码语言:javascript
运行
复制
import "quill-emoji/dist/quill-emoji.css";

next.config.js

代码语言:javascript
运行
复制
const withCSS = require('@zeit/next-css');
const withImages = require("next-images");
const withPlugins = require("next-compose-plugins");


if (typeof require !== 'undefined') {
    require.extensions['.less'] = () => {};
    require.extensions['.css'] = file => {};
}

module.exports = withPlugins([
    withImages,
    withCSS
], {
    devIndicators: {
        autoPrerender: false,
    },
    webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => {
...
})
EN

Stack Overflow用户

回答已采纳

发布于 2020-07-25 04:54:36

emoji css似乎包含了data:image的内容,并加载了svg的内联。

我尝试了多个加载器,但找不到正确的顺序,你可能需要某个特定顺序的resolve-url-loader

最好是使用next/head将其链接起来,然后结束它。

票数 1
EN
查看全部 2 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63080696

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档