From a6af1f5ecae7b30ae26066335e78653e8d5e2e04 Mon Sep 17 00:00:00 2001 From: eduardhrachou Date: Tue, 9 Jan 2024 15:04:11 +0300 Subject: [PATCH] fix --- gatsby-node.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/gatsby-node.js b/gatsby-node.js index b29f18a9fff..71a2c809837 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -397,17 +397,15 @@ const style_lint_options = { lintDirtyModulesOnly: true, } -exports.onCreateWebpackConfig = ({ stage, actions, loaders }, { noUglify, ...options }) => { - const isProduction = stage === 'build-html' || stage === 'build-javascript' +exports.onCreateWebpackConfig = ({ actions, loaders, getConfig }, { ...options }) => { + const config = getConfig() + const isProduction = config.mode === 'production' actions.setWebpackConfig({ devtool: false, - performance: { - hints: isProduction ? 'warning' : false, - }, optimization: { - minimize: isProduction && !noUglify, - minimizer: isProduction && !noUglify ? [new TerserPlugin()] : [], + minimize: isProduction, + minimizer: [new TerserPlugin()], }, plugins: [new StylelintPlugin({ ...style_lint_options, ...options })], resolve: {