簡體   English   中英

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

[英]Deploy failed on netlify css ./node_modules/gatsby/node_modules/css-loader

我在部署 netlify 時遇到了問題,一些我不明白的沖突。 我嘗試清除緩存,重建基礎,重建包,在 netlify 上重新部署,重新安裝 mini-CSS-extract-plugin。

調試 Netlify:

上午 11:38:12:警告塊樣式 [mini-css-extract-plugin] 上午 11:38:12:順序沖突。 添加了以下模塊: 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:盡管它無法通過這些模塊實現所需的排序: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 : - 無法滿足塊組組件的所需順序---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)
  }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM