Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
handle trailing slash edge case for file paths
  • Loading branch information
xjlim committed Oct 3, 2017
commit 2d6875f3ef0c7ad3c056ba05a7a03e37ecb9eb58
10 changes: 7 additions & 3 deletions packages/react-dev-utils/getProcessForPort.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function getProcessCommand(processId, processDirectory) {
execOptions
);

command = command.replace(/\n$/, '')
command = command.replace(/\n$/, '');

if (isProcessAReactApp(command)) {
const packageName = getPackageNameInDirectory(processDirectory);
Expand All @@ -68,8 +68,12 @@ function getProcessForPort(port) {
var processId = getProcessIdOnPort(port);
var directory = getDirectoryOfProcessById(processId);
var command = getProcessCommand(processId, directory);
return chalk.cyan(command) + chalk.grey(' (pid ' + processId + ')\n') +
chalk.blue(' in ') + chalk.cyan(directory);
return (
chalk.cyan(command) +
chalk.grey(' (pid ' + processId + ')\n') +
chalk.blue(' in ') +
chalk.cyan(directory)
);
} catch (e) {
return null;
}
Expand Down
6 changes: 5 additions & 1 deletion packages/react-scripts/config/webpackDevServer.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

const errorOverlayMiddleware = require('react-dev-utils/errorOverlayMiddleware');
const noopServiceWorkerMiddleware = require('react-dev-utils/noopServiceWorkerMiddleware');
const path = require('path');
const config = require('./webpack.config.dev');
const paths = require('./paths');

Expand Down Expand Up @@ -75,7 +76,10 @@ module.exports = function(proxy, allowedHost) {
// src/node_modules is not ignored to support absolute imports
// https://github.com/facebookincubator/create-react-app/issues/1065
watchOptions: {
ignored: new RegExp(`^(?!${paths.appSrc}).+[\\/]node_modules[\\/]`, 'g'),
ignored: new RegExp(
`^(?!${path.normalize(paths.appSrc + '/')}).+[\\/]node_modules[\\/]`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that technically this stays in ejected projects forever. It looks extremely cryptic.
Can we extract this somewhere to react-dev-utils?

'g'
),
},
// Enable HTTPS if the HTTPS environment variable is set to 'true'
https: protocol === 'https',
Expand Down