css - 在 netlify css 上部署失败 ./node_modules/gatsby/node_modules/css-loader

标签 css json deployment gatsby netlify

我在部署 netlify 时遇到问题,有些冲突我不明白。 我尝试清除缓存、重建基础、重建包、在 netlify 上重新部署、重新安装 mini-CSS-extract-plugin。

调试 Netlify:

11:38:12 AM: warning chunk styles [mini-css-extract-plugin] 11:38:12 AM: Conflicting order. Following module has been added: 11:38:12 AM: * css ./node_modules/gatsby/node_modules/css-loader??ref--12-oneOf-1-1!./node_modules/postcss-loader/lib??postcss-2!./node_modules/typeface-roboto/index.css 11:38:12 AM: despite it was not able to fulfill desired ordering with these modules: 11:38:12 AM: * css ./node_modules/gatsby/node_modules/css-loader??ref--12-oneOf-1-1!./node_modules/postcss-loader/lib??postcss-2!./node_modules/typeface-montserrat/index.css 11:38:12 AM: - couldn't fulfill desired order of chunk group(s) component---src-pages-404-js

这是什么意思,如何解决?

    "css-loader": {
  "version": "3.4.2",
  "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-3.4.2.tgz",
  "integrity": "sha512-jYq4zdZT0oS0Iykt+fqnzVLRIeiPWhka+7BqPn+oSIpWJAHak5tmB/WZrJ2a21JhCeFyNnnlroSl8c+MtVndzA==",
  "requires": {
    "camelcase": "^5.3.1",
    "cssesc": "^3.0.0",
    "icss-utils": "^4.1.1",
    "loader-utils": "^1.2.3",
    "normalize-path": "^3.0.0",
    "postcss": "^7.0.23",
    "postcss-modules-extract-imports": "^2.0.0",
    "postcss-modules-local-by-default": "^3.0.2",
    "postcss-modules-scope": "^2.1.1",
    "postcss-modules-values": "^3.0.0",
    "postcss-value-parser": "^4.0.2",
    "schema-utils": "^2.6.0"
  }
},
    "mini-css-extract-plugin": {
      "version": "0.8.2",
      "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-0.8.2.tgz",
      "integrity": "sha512-a3Y4of27Wz+mqK3qrcd3VhYz6cU0iW5x3Sgvqzbj+XmlrSizmvu8QQMl5oMYJjgHOC4iyt+w7l4umP+dQeW3bw==",
      "requires": {
        "loader-utils": "^1.1.0",
        "normalize-url": "1.9.1",
        "schema-utils": "^1.0.0",
        "webpack-sources": "^1.1.0"
      }
    },

最佳答案

这些警告是由于 webpack 配置导致的错误顺序导入 CSS 模块。您可以通过在 gatsby-node.js 中添加以下代码段来删除它们:

exports.onCreateWebpackConfig = ({ stage, actions, getConfig }) => {
  if (stage === 'build-javascript') {
    const config = getConfig()
    const miniCssExtractPlugin = config.plugins.find(
      plugin => plugin.constructor.name === 'MiniCssExtractPlugin'
    )
    if (miniCssExtractPlugin) {
      miniCssExtractPlugin.options.ignoreOrder = true
    }
    actions.replaceWebpackConfig(config)
  }
}

关于css - 在 netlify css 上部署失败 ./node_modules/gatsby/node_modules/css-loader,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59877142/

相关文章:

mysql - Rails 应用程序已部署并正常运行,但 MySQL 数据库显示为空

jquery - 使用外部 jquery 脚本更改 CSS

ruby-on-rails - 在 Dokku 上部署后的 Rake 命令

node.js - 如何在 Azure 网站上托管的express.js 应用程序上设置后台进程?

javascript - 强制 Chrome 显示格式为树结构的 Json 响应

java - 如何在运行时从 json 数组中删除完整条目

javascript - 无法在客户端编辑json文件

javascript - 如何使用d3过渡使圆圈一个接一个出现?

javascript - 使用 jquery 更改悬停时的背景颜色无法正常工作

html - CSS:为什么我的 HTML 元素以某种方式相对定位?