@mediacurrent/gatsby-plugin-silence-css-order-warning
Version:
Gatsby plugin to silence CSS order warning when using CSS modules or other CSS in JS.
18 lines (17 loc) • 625 B
JavaScript
exports.onCreateWebpackConfig = ({ stage, getConfig, actions }) => {
// Silence 'conflicting order' warning for CSS modules.
// This is only an issue with regular CSS being imported.
if (stage === 'build-javascript') {
const config = getConfig()
// Get the mini-css-extract-plugin
const miniCssExtractPlugin = config.plugins.find(
(plugin) => plugin.constructor.name === 'MiniCssExtractPlugin'
)
// Set the option here to true.
if (miniCssExtractPlugin) {
miniCssExtractPlugin.options.ignoreOrder = true
}
// Update the config.
actions.replaceWebpackConfig(config)
}
}