mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-05-16 19:09:05 +08:00
Minor tweaks
This commit is contained in:
@@ -12,16 +12,15 @@ var autoprefixer = require('autoprefixer');
|
||||
var webpack = require('webpack');
|
||||
var HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
|
||||
function isInDebugMode() {
|
||||
return process.argv.some(function (item) { return item.indexOf('--debug-template') > -1 });
|
||||
}
|
||||
|
||||
// TODO: hide this behind a flag and eliminate dead code on eject.
|
||||
// This shouldn't be exposed to the user.
|
||||
var isInNodeModules = 'node_modules' ===
|
||||
path.basename(path.resolve(path.join(__dirname, '..', '..')));
|
||||
var relativePath = isInNodeModules ? '../../..' : '..';
|
||||
if (isInDebugMode()) {
|
||||
var isInDebugMode = process.argv.some(arg =>
|
||||
arg.indexOf('--debug-template') > -1
|
||||
);
|
||||
if (isInDebugMode) {
|
||||
relativePath = '../template';
|
||||
}
|
||||
var srcPath = path.resolve(__dirname, relativePath, 'src');
|
||||
|
||||
@@ -17,14 +17,13 @@ var config = require('../config/webpack.config.dev');
|
||||
var execSync = require('child_process').execSync;
|
||||
var opn = require('opn');
|
||||
|
||||
function isSmokeTest() {
|
||||
return process.argv.some(function (item) { return item.indexOf('--smoke-test') > -1 });
|
||||
}
|
||||
|
||||
// TODO: hide this behind a flag and eliminate dead code on eject.
|
||||
// This shouldn't be exposed to the user.
|
||||
var handleCompile;
|
||||
if (isSmokeTest()) {
|
||||
var isSmokeTest = process.argv.some(arg =>
|
||||
arg.indexOf('--smoke-test') > -1
|
||||
);
|
||||
if (isSmokeTest) {
|
||||
handleCompile = function (err, stats) {
|
||||
if (err || stats.hasErrors() || stats.hasWarnings()) {
|
||||
process.exit(1);
|
||||
|
||||
Reference in New Issue
Block a user