简体   繁体   中英

Deploy failed on netlify css ./node_modules/gatsby/node_modules/css-loader

I've got a problem on deploying netlify, some conflicts that I don't understand. I tried clearing cache, rebuild base, rebuild packages, redeploy on netlify, reinstall mini-CSS-extract-plugin.

Debug 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

what does it mean and how to fix it?

    "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"
      }
    },

Those warnings are bad order importation CSS modules due to webpack configuration. You can remove them by adding the following snippet in your 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)
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM