How to use the react-scripts/config/webpack.config.prod.js.plugins function in react-scripts

To help you get started, we’ve selected a few react-scripts examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github humanmade / react-wp-scripts / config / webpack.config.prod.js View on Github external
const config = require( 'react-scripts/config/webpack.config.prod.js' );
const { GenerateSW } = require( 'workbox-webpack-plugin' );
const applyWpConfig = require( '../overrides/applyWpConfig' );

// Remove default Workbox plugin.
config.plugins = config.plugins.filter( plugin => ! ( plugin instanceof GenerateSW ) );

// Generate a service worker script that will precache, and keep up to date,
// the HTML & assets that are part of the Webpack build without the navigation
// fallback.
config.plugins.push( new GenerateSW( {
  clientsClaim: true,
  exclude: [ /\.map$/, /asset-manifest\.json$/ ],
  importWorkboxFrom: 'cdn',
} ) );

module.exports = applyWpConfig( config );
github humanmade / react-wp-scripts / config / webpack.config.prod.js View on Github external
const config = require( 'react-scripts/config/webpack.config.prod.js' );
const { GenerateSW } = require( 'workbox-webpack-plugin' );
const applyWpConfig = require( '../overrides/applyWpConfig' );

// Remove default Workbox plugin.
config.plugins = config.plugins.filter( plugin => ! ( plugin instanceof GenerateSW ) );

// Generate a service worker script that will precache, and keep up to date,
// the HTML & assets that are part of the Webpack build without the navigation
// fallback.
config.plugins.push( new GenerateSW( {
  clientsClaim: true,
  exclude: [ /\.map$/, /asset-manifest\.json$/ ],
  importWorkboxFrom: 'cdn',
} ) );

module.exports = applyWpConfig( config );