diff --git a/config/webpack/webpack.analyze.js b/config/webpack/webpack.analyze.js index d4061b24..804ff0fd 100644 --- a/config/webpack/webpack.analyze.js +++ b/config/webpack/webpack.analyze.js @@ -1,12 +1,10 @@ -const merge = require('webpack-merge'); -const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer'); +const merge = require('webpack-merge') +const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer') const analyzeConfig = { - plugins: [ - new BundleAnalyzerPlugin({ analyzerMode: 'static' }) - ] -}; + plugins: [new BundleAnalyzerPlugin({ analyzerMode: 'static' })] +} -const prodConfig = require('./webpack.prod.js'); +const prodConfig = require('./webpack.prod.js') -module.exports = merge(prodConfig, analyzeConfig); +module.exports = merge(prodConfig, analyzeConfig) diff --git a/config/webpack/webpack.shared.js b/config/webpack/webpack.shared.js index d11e68c1..b7797912 100644 --- a/config/webpack/webpack.shared.js +++ b/config/webpack/webpack.shared.js @@ -1,17 +1,14 @@ -const { copyFileSync, readFileSync } = require('fs') const { dirname, join } = require('path') const AppManifestWebpackPlugin = require('app-manifest-webpack-plugin') const CleanWebpackPlugin = require('clean-webpack-plugin') const CopyWebpackPlugin = require('copy-webpack-plugin') const DefinePlugin = require('webpack/lib/DefinePlugin') const EnvironmentPlugin = require('webpack/lib/EnvironmentPlugin') -const EventHooksPlugin = require('event-hooks-webpack-plugin') const HtmlWebpackPlugin = require('html-webpack-plugin') const sass = require('sass') const autoprefixer = require('autoprefixer') const mqpacker = require('css-mqpacker') -const get = require('lodash.get') -const { map } = require('@code.gov/cautious') +const ImageminPlugin = require('imagemin-webpack-plugin').default const rootDir = dirname(dirname(__dirname)) const nodeModulesDir = join(rootDir, 'node_modules') @@ -227,6 +224,7 @@ module.exports = { new EnvironmentPlugin(['CODE_GOV_API_BASE', 'CODE_GOV_API_KEY', 'CODE_GOV_TASKS_URL']), new CleanWebpackPlugin([OUTPUT_PATH], { root: rootDir }), new CopyWebpackPlugin(patterns), + new ImageminPlugin({ test: /\.(jpe?g|png|gif|svg)$/i }), new HtmlWebpackPlugin({ hash: true, template: 'index.html', diff --git a/package.json b/package.json index 69c272b5..471a886d 100644 --- a/package.json +++ b/package.json @@ -74,6 +74,7 @@ "event-hooks-webpack-plugin": "^2.1.1", "history": "^4.9.0", "html-webpack-plugin": "^3.2.0", + "imagemin-webpack-plugin": "^2.4.2", "jsoneditor": "^6.0.0", "lodash.assign": "^4.2.0", "lodash.get": "^4.4.2",