Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
//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');
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',
})
});
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 + "/../"
})
});