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

Commit

Permalink
source-maps disabling using webpack config on gatsby-node.js file
Browse files Browse the repository at this point in the history
  • Loading branch information
eduard-deriv committed Jan 18, 2024
1 parent 2df9a02 commit 999518e
Showing 1 changed file with 7 additions and 18 deletions.
25 changes: 7 additions & 18 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,27 +397,16 @@ const style_lint_options = {
lintDirtyModulesOnly: true,
}

exports.onCreateWebpackConfig = ({ stage, actions, loaders, getConfig }, { ...options }) => {
const config = getConfig()
if (config.optimization) {
config.optimization.minimizer = [new TerserPlugin()]
}
if (stage === 'build-html' || stage === 'develop-html') {
actions.setWebpackConfig({
module: {
rules: [
{
test: /analytics/,
use: loaders.null(),
},
],
},
})
}
exports.onCreateWebpackConfig = ({ stage, actions, loaders }, { ...options }) => {
actions.setWebpackConfig({
devtool: false,
optimization: {
minimizer: [new TerserPlugin()],
},
plugins: [new StylelintPlugin({ ...style_lint_options, ...options })],
resolve: {
modules: [path.resolve(__dirname, 'src'), 'node_modules'],
},
...((stage === 'build-html' || stage === 'develop-html') ? { module: { rules: [ { test: /analytics/, use: loaders.null() } ] } } : {}),
})
}
}

0 comments on commit 999518e

Please sign in to comment.