Skip to content
This repository has been archived by the owner on Sep 26, 2024. It is now read-only.

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
eduard-deriv committed Jan 9, 2024
1 parent b44734a commit a6af1f5
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down

0 comments on commit a6af1f5

Please sign in to comment.