-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgraded the build tools to ES6. #36
- Loading branch information
1 parent
76c5815
commit aa896f6
Showing
6 changed files
with
91 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,45 @@ | ||
// 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 */ | ||
var webpack = require('webpack'); | ||
var webpackConfigBuilder = require('../webpack.config'); | ||
var colors = require('colors'); | ||
var args = require('yargs').argv; | ||
import webpack from 'webpack'; | ||
import webpackConfigBuilder from '../webpack.config'; | ||
import colors from 'colors'; | ||
import { argv as args } from 'yargs'; | ||
|
||
process.env.NODE_ENV='production'; //this assures React is built in prod mode and that the Babel dev config doesn't apply. | ||
process.env.NODE_ENV = 'production'; // this assures React is built in prod mode and that the Babel dev config doesn't apply. | ||
|
||
var webpackConfig = webpackConfigBuilder('production'); | ||
const webpackConfig = webpackConfigBuilder(process.env.NODE_ENV); | ||
|
||
webpack(webpackConfig).run(function(err, stats) { | ||
var inSilentMode = args.s; //set to true when -s is passed on the command | ||
webpack(webpackConfig).run((err, stats) => { | ||
const inSilentMode = args.s; // set to true when -s is passed on the command | ||
|
||
if (!inSilentMode) console.log('Generating minified bundle for production use via Webpack...'.bold.blue); | ||
if (!inSilentMode) { | ||
console.log('Generating minified bundle for production use via Webpack...'.bold.blue); | ||
} | ||
|
||
if (err) { //so a fatal error occurred. Stop here. | ||
if (err) { // so a fatal error occurred. Stop here. | ||
console.log(err.bold.red); | ||
|
||
return 1; | ||
} | ||
|
||
var jsonStats = stats.toJson(); | ||
const jsonStats = stats.toJson(); | ||
|
||
if (jsonStats.hasErrors) return jsonStats.errors.map(error => console.log(error.red)); | ||
if (jsonStats.hasErrors) { | ||
return jsonStats.errors.map(error => console.log(error.red)); | ||
} | ||
|
||
if (jsonStats.hasWarnings && !inSilentMode) { | ||
console.log('Webpack generated the following warnings: '.bold.yellow); | ||
jsonStats.warnings.map(warning => console.log(warning.yellow)); | ||
} | ||
|
||
if (!inSilentMode) console.log('Webpack stats: ' + stats.toString()); | ||
if (!inSilentMode) { | ||
console.log(`Webpack stats: ${stats}`); | ||
} | ||
|
||
//if we got this far, the build succeeded. | ||
// if we got this far, the build succeeded. | ||
console.log('Your app has been compiled in production mode and written to /dist. It\'s ready to roll!'.green.bold); | ||
|
||
return 0; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters