Commit ecd1f054 authored by Tharaka Wijebandara's avatar Tharaka Wijebandara Committed by Dan Abramov
Browse files

Convert react-error-overlay to React (#2515)

* Convert react-error-overlay to React

* Update compile-time error overlay to use react-error-overlay components

 * Refactor react-error-overlay components to container and presentational components.

 * Make the compile-time error overlay a part of react-error-overlay package.

 * Use react-error-overlay as dependency in react-dev-utils to show compile-time errors.

* Run Prettier

* Move the function name fix into StackFrame itself

* Fix clicking on source code snippet to open the code in editor

* Use exact objects + minor style tweak

* Don't linkify frames that don't exist on the disk

* Fix lint

* Consolidate iframe rendering logic

* Remove circular dependency between react-dev-utils and react-error-overlay

* Fix lint

* Fix decoupling of react-dev-utils and react-error-overlay by moving middleware

* Deduplicate identical errors
parent 3b917482
Showing with 6 additions and 8 deletions
+6 -8
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory. * of patent rights can be found in the PATENTS file in the same directory.
*/ */
// @flow /* @flow */
import StackFrame from './stack-frame'; import StackFrame from './stack-frame';
import { getSourceMap } from './getSourceMap'; import { getSourceMap } from './getSourceMap';
import { getLinesAround } from './getLinesAround'; import { getLinesAround } from './getLinesAround';
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory. * of patent rights can be found in the PATENTS file in the same directory.
*/ */
// @flow /* @flow */
import type { ReactFrame } from '../effects/proxyConsole'; import type { ReactFrame } from '../effects/proxyConsole';
function stripInlineStacktrace(message: string): string { function stripInlineStacktrace(message: string): string {
......
...@@ -13,8 +13,9 @@ ...@@ -13,8 +13,9 @@
const spawn = require('react-dev-utils/crossSpawn'); const spawn = require('react-dev-utils/crossSpawn');
const args = process.argv.slice(2); const args = process.argv.slice(2);
const scriptIndex = args.findIndex(x => const scriptIndex = args.findIndex(
x === 'build' || x === 'eject' || x === 'start' || x === 'test'); x => x === 'build' || x === 'eject' || x === 'start' || x === 'test'
);
const script = scriptIndex === -1 ? args[0] : args[scriptIndex]; const script = scriptIndex === -1 ? args[0] : args[scriptIndex];
const nodeArgs = scriptIndex > 0 ? args.slice(0, scriptIndex) : []; const nodeArgs = scriptIndex > 0 ? args.slice(0, scriptIndex) : [];
......
...@@ -56,8 +56,6 @@ module.exports = { ...@@ -56,8 +56,6 @@ module.exports = {
require.resolve('react-dev-utils/webpackHotDevClient'), require.resolve('react-dev-utils/webpackHotDevClient'),
// We ship a few polyfills by default: // We ship a few polyfills by default:
require.resolve('./polyfills'), require.resolve('./polyfills'),
// Errors should be considered fatal in development
require.resolve('react-error-overlay'),
// Finally, this is your app's code: // Finally, this is your app's code:
paths.appIndexJs, paths.appIndexJs,
// We include the app code last so that if there is a runtime error during // We include the app code last so that if there is a runtime error during
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
// @remove-on-eject-end // @remove-on-eject-end
'use strict'; 'use strict';
const errorOverlayMiddleware = require('react-error-overlay/middleware'); const errorOverlayMiddleware = require('react-dev-utils/errorOverlayMiddleware');
const noopServiceWorkerMiddleware = require('react-dev-utils/noopServiceWorkerMiddleware'); const noopServiceWorkerMiddleware = require('react-dev-utils/noopServiceWorkerMiddleware');
const config = require('./webpack.config.dev'); const config = require('./webpack.config.dev');
const paths = require('./paths'); const paths = require('./paths');
......
...@@ -49,7 +49,6 @@ ...@@ -49,7 +49,6 @@
"postcss-loader": "2.0.6", "postcss-loader": "2.0.6",
"promise": "8.0.1", "promise": "8.0.1",
"react-dev-utils": "^3.1.0", "react-dev-utils": "^3.1.0",
"react-error-overlay": "^1.0.10",
"style-loader": "0.18.2", "style-loader": "0.18.2",
"sw-precache-webpack-plugin": "0.11.4", "sw-precache-webpack-plugin": "0.11.4",
"url-loader": "0.5.9", "url-loader": "0.5.9",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment