How to use the react-scripts/config/webpack.config.prod.output 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 rafi16jan / rapyd-framework / client / scripts / build.js View on Github external
//require('module-alias/register');
process.env.NODE_ENV = 'production';
process.env.NODE_PATH = './src';

const config = require('react-scripts/config/webpack.config.prod');
const OfflinePlugin = require('offline-plugin');

//config.plugins.splice(5, 1);

config.output.publicPath = '';

config.plugins.push(new OfflinePlugin({appShell: 'index.html', ServiceWorker: {prefetchRequest: {mode: 'no-cors'}, events: true}, AppCache: {events: true}, relativePaths: true}));


config.resolve.alias['react'] = require('path').join(__dirname, '../src/react.js');//'preact-compat';
config.resolve.alias['react-dom'] = require('path').join(__dirname, '../src/react-dom.js');//'preact-compat';
config.resolve.alias['pouchdb-promise'] = require('path').join(__dirname, '../node_modules/pouchdb-promise/lib/index.js');

config.module.rules.push({test: /framework7\.min\.css$/, loader: 'string-replace-loader', options: {search: '\#9e9e9e', replace: '#009688', flags: 'g'}});
//config.module.rules.push({test: /sw\.js$/, loader: 'string-replace-loader', options: {search: ',e.respondWith\(f\)', replace: ';try{e.respondWith(f)}catch(error){}'}});

require('react-scripts/scripts/build');
github CakeDC / mixer / webpack.config.prod.js View on Github external
const cssFilename = 'css/[name].css';

module.exports = Object.assign({}, reactScriptsConfig, {
    devtool: false,
    plugins: reactScriptsConfig.plugins
        .map(function (plugin, index) {
            if (index === 4) {
                return new ExtractTextPlugin(cssFilename);
            }

            return plugin;
        })
        .filter((plugin, index) => [0, 1, 5, 6].indexOf(index) === -1),
    entry: reactScriptsConfig.entry
        .map(entry => entry.includes('src' + path.sep + 'index.js') ? resolveApp('src' + path.sep + 'React' + path.sep + 'index.js') : entry),
    output: Object.assign({}, reactScriptsConfig.output, {
        path: resolveApp('webroot'),
        filename: 'js/[name].js',
        chunkFilename: 'js/[name].chunk.js',
    })
});
github centreon / centreon / www / front_src / webpack.config.js View on Github external
process.env.NODE_ENV = "production";
var reactScriptsConfig = require("react-scripts/config/webpack.config.prod");
module.exports = Object.assign({}, reactScriptsConfig, {
  entry: ["@babel/polyfill", __dirname + "/src/index.js"],
  output: Object.assign({}, reactScriptsConfig.output, {
    path: __dirname + "/../"
  })
});