react-dev-utils
Advanced tools
Comparing version
@@ -20,3 +20,3 @@ /** | ||
execSync( | ||
'osascript chrome.applescript ' + url, | ||
'osascript openChrome.applescript ' + url, | ||
{cwd: __dirname, stdio: 'ignore'} | ||
@@ -32,3 +32,3 @@ ); | ||
try { | ||
opn(url); | ||
opn(url).catch(() => {}); // Prevent `unhandledRejection` error. | ||
return true; | ||
@@ -35,0 +35,0 @@ } catch (err) { |
{ | ||
"name": "react-dev-utils", | ||
"version": "0.2.1", | ||
"version": "0.3.0-alpha.9c45b252", | ||
"description": "Webpack utilities used by Create React App", | ||
@@ -32,6 +32,3 @@ "repository": "facebookincubator/create-react-app", | ||
"strip-ansi": "3.0.1" | ||
}, | ||
"peerDependencies": { | ||
"webpack": "^1.13.2" | ||
} | ||
} |
@@ -113,3 +113,3 @@ # react-dev-utils | ||
#### `formatWebpackMessages(stats: WebpackStats): {errors: Array<string>, warnings: Array<string>}` | ||
#### `formatWebpackMessages({errors: Array<string>, warnings: Array<string>}): {errors: Array<string>, warnings: Array<string>}` | ||
@@ -129,3 +129,4 @@ Extracts and prettifies warning and error messages from webpack [stats](https://github.com/webpack/docs/wiki/node.js-api#stats) object. | ||
compiler.plugin('done', function(stats) { | ||
var messages = formatWebpackMessages(stats); | ||
var rawMessages = stats.toJson({}, true); | ||
var messages = formatWebpackMessages(rawMessages); | ||
if (!messages.errors.length && !messages.warnings.length) { | ||
@@ -132,0 +133,0 @@ console.log('Compiled successfully!'); |
@@ -109,3 +109,3 @@ /** | ||
// Zalgo alert: onIframeLoad() will be called either synchronouly | ||
// Zalgo alert: onIframeLoad() will be called either synchronously | ||
// or asynchronously depending on the browser. | ||
@@ -127,2 +127,15 @@ // We delay adding it so `overlayIframe` is set when `onIframeLoad` fires. | ||
function destroyErrorOverlay() { | ||
if (!overlayDiv) { | ||
// It is not there in the first place. | ||
return; | ||
} | ||
// Clean up and reset internal state. | ||
document.body.removeChild(overlayIframe); | ||
overlayDiv = null; | ||
overlayIframe = null; | ||
lastOnOverlayDivReady = null; | ||
} | ||
// Connect to WebpackDevServer via a socket. | ||
@@ -161,2 +174,3 @@ var connection = new SockJS(url.format({ | ||
clearOutdatedErrors(); | ||
destroyErrorOverlay(); | ||
@@ -176,2 +190,3 @@ var isHotUpdate = !isFirstCompilation; | ||
clearOutdatedErrors(); | ||
destroyErrorOverlay(); | ||
@@ -279,4 +294,3 @@ var isHotUpdate = !isFirstCompilation; | ||
// https://webpack.github.io/docs/hot-module-replacement.html#check | ||
module.hot.check(/* autoApply */true, function(err, updatedModules) { | ||
function handleApplyUpdates(err, updatedModules) { | ||
if (err || !updatedModules) { | ||
@@ -296,3 +310,18 @@ window.location.reload(); | ||
} | ||
}); | ||
} | ||
// https://webpack.github.io/docs/hot-module-replacement.html#check | ||
var result = module.hot.check(/* autoApply */true, handleApplyUpdates); | ||
// // Webpack 2 returns a Promise instead of invoking a callback | ||
if (result && result.then) { | ||
result.then( | ||
function(updatedModules) { | ||
handleApplyUpdates(null, updatedModules); | ||
}, | ||
function(err) { | ||
handleApplyUpdates(err, null); | ||
} | ||
); | ||
} | ||
}; |
Sorry, the diff of this file is not supported yet
28886
2.93%7
-12.5%581
4.5%204
0.49%