Skip to content

Commit

Permalink
Merge pull request layer5io#6136 from ShivamCoder23/css/issue
Browse files Browse the repository at this point in the history
set config for css conflict warning
  • Loading branch information
sudhanshutech authored Dec 30, 2024
2 parents 8db79d3 + 9b9d2c9 commit 69f137a
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 55 deletions.
1 change: 1 addition & 0 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module.exports = {
},
trailingSlash: "never",
plugins: [
"@mediacurrent/gatsby-plugin-silence-css-order-warning",
{
resolve: "gatsby-plugin-webpack-bundle-analyser-v2",
options: {
Expand Down
25 changes: 24 additions & 1 deletion gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const path = require("path");
const slugify = require("./src/utils/slugify");
const { paginate } = require("gatsby-awesome-pagination");
const { createFilePath } = require("gatsby-source-filesystem");
const FilterWarningsPlugin = require("webpack-filter-warnings-plugin");
const config = require("./gatsby-config");
const {
componentsData,
Expand Down Expand Up @@ -977,7 +978,7 @@ const createSectionPage = ({ envCreatePage, node }) => {
});
};

exports.onCreateWebpackConfig = ({ actions }) => {
exports.onCreateWebpackConfig = ({ actions, stage, getConfig }) => {
actions.setWebpackConfig({
resolve: {
fallback: {
Expand All @@ -987,7 +988,29 @@ exports.onCreateWebpackConfig = ({ actions }) => {
},
},
});
actions.setWebpackConfig({
plugins: [
new FilterWarningsPlugin({
exclude:
/mini-css-extract-plugin[^]*Conflicting order. Following module has been added:/,
}),
],
});

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);
}
};

exports.createSchemaCustomization = ({ actions }) => {
const { createTypes } = actions;
const typeDefs = `
Expand Down
135 changes: 81 additions & 54 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"@loadable/component": "^5.16.4",
"@mdx-js/mdx": "1.6.22",
"@mdx-js/react": "1.6.22",
"@mediacurrent/gatsby-plugin-silence-css-order-warning": "^1.0.0",
"@mui/icons-material": "^5.16.4",
"@mui/material": "^5.15.11",
"@react-icons/all-files": "^4.1.0",
Expand Down Expand Up @@ -78,6 +79,7 @@
"joi": "^17.10.2",
"js-search": "^2.0.0",
"lodash": "^4.17.21",
"mini-css-extract-plugin": "^2.9.2",
"mui-datatables": "^4.3.0",
"path-browserify": "^1.0.1",
"prism-react-renderer": "^2.0.6",
Expand Down Expand Up @@ -112,6 +114,7 @@
"styled-components": "^6.0.5",
"swiper": "^10.0.4",
"url": "^0.11.3",
"webpack-filter-warnings-plugin": "^1.2.1",
"xstate": "^5.13.0"
},
"devDependencies": {
Expand Down

0 comments on commit 69f137a

Please sign in to comment.