Skip to content

Commit 69f137a

Browse files
Merge pull request #6136 from ShivamCoder23/css/issue
set config for css conflict warning
2 parents 8db79d3 + 9b9d2c9 commit 69f137a

4 files changed

Lines changed: 109 additions & 55 deletions

File tree

gatsby-config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ module.exports = {
1717
},
1818
trailingSlash: "never",
1919
plugins: [
20+
"@mediacurrent/gatsby-plugin-silence-css-order-warning",
2021
{
2122
resolve: "gatsby-plugin-webpack-bundle-analyser-v2",
2223
options: {

gatsby-node.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const path = require("path");
99
const slugify = require("./src/utils/slugify");
1010
const { paginate } = require("gatsby-awesome-pagination");
1111
const { createFilePath } = require("gatsby-source-filesystem");
12+
const FilterWarningsPlugin = require("webpack-filter-warnings-plugin");
1213
const config = require("./gatsby-config");
1314
const {
1415
componentsData,
@@ -977,7 +978,7 @@ const createSectionPage = ({ envCreatePage, node }) => {
977978
});
978979
};
979980

980-
exports.onCreateWebpackConfig = ({ actions }) => {
981+
exports.onCreateWebpackConfig = ({ actions, stage, getConfig }) => {
981982
actions.setWebpackConfig({
982983
resolve: {
983984
fallback: {
@@ -987,7 +988,29 @@ exports.onCreateWebpackConfig = ({ actions }) => {
987988
},
988989
},
989990
});
991+
actions.setWebpackConfig({
992+
plugins: [
993+
new FilterWarningsPlugin({
994+
exclude:
995+
/mini-css-extract-plugin[^]*Conflicting order. Following module has been added:/,
996+
}),
997+
],
998+
});
999+
1000+
if (stage === "build-javascript") {
1001+
const config = getConfig();
1002+
const miniCssExtractPlugin = config.plugins.find(
1003+
(plugin) => plugin.constructor.name === "MiniCssExtractPlugin"
1004+
);
1005+
1006+
if (miniCssExtractPlugin) {
1007+
miniCssExtractPlugin.options.ignoreOrder = true;
1008+
}
1009+
1010+
actions.replaceWebpackConfig(config);
1011+
}
9901012
};
1013+
9911014
exports.createSchemaCustomization = ({ actions }) => {
9921015
const { createTypes } = actions;
9931016
const typeDefs = `

package-lock.json

Lines changed: 81 additions & 54 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"@loadable/component": "^5.16.4",
3939
"@mdx-js/mdx": "1.6.22",
4040
"@mdx-js/react": "1.6.22",
41+
"@mediacurrent/gatsby-plugin-silence-css-order-warning": "^1.0.0",
4142
"@mui/icons-material": "^5.16.4",
4243
"@mui/material": "^5.15.11",
4344
"@react-icons/all-files": "^4.1.0",
@@ -78,6 +79,7 @@
7879
"joi": "^17.10.2",
7980
"js-search": "^2.0.0",
8081
"lodash": "^4.17.21",
82+
"mini-css-extract-plugin": "^2.9.2",
8183
"mui-datatables": "^4.3.0",
8284
"path-browserify": "^1.0.1",
8385
"prism-react-renderer": "^2.0.6",
@@ -112,6 +114,7 @@
112114
"styled-components": "^6.0.5",
113115
"swiper": "^10.0.4",
114116
"url": "^0.11.3",
117+
"webpack-filter-warnings-plugin": "^1.2.1",
115118
"xstate": "^5.13.0"
116119
},
117120
"devDependencies": {

0 commit comments

Comments
 (0)