redux-react-session
Version:
[](https://npmjs.org/package/redux-react-session) [](https://travis-ci.org/bernabe9/
35 lines (25 loc) • 1.11 kB
JavaScript
// More info on Webpack's Node API here: https://webpack.github.io/docs/node.js-api.html
// Allowing console calls below since this is a build file.
/* eslint-disable no-console */
import webpack from 'webpack';
import config from '../webpack.config.prod';
process.env.NODE_ENV = 'production'; // this assures React is built in prod mode and that the Babel dev config doesn't apply.
console.log('Generating minified bundle for production via Webpack. This will take a moment...');
webpack(config).run((error, stats) => {
if (error) { // so a fatal error occurred. Stop here.
console.log(error);
return 1;
}
const jsonStats = stats.toJson();
if (jsonStats.hasErrors) {
return jsonStats.errors.map(error => console.log(error));
}
if (jsonStats.hasWarnings) {
console.log('Webpack generated the following warnings: ');
jsonStats.warnings.map(warning => console.log(warning));
}
console.log(`Webpack stats: ${stats}`);
// if we got this far, the build succeeded.
console.log('Your app is compiled in production mode in /dist. It\'s ready to roll!');
return 0;
});