Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
12 changes: 1 addition & 11 deletions bin/launch-fp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,6 @@
# launch-fp.sh
# then only the server will be launched.

if [ "x$1" != "x" ]; then
PROFILEPATH=$(realpath "$1")
fi
PWD=$(pwd)
SCRIPTPATH=$(realpath "$0")
SCRIPTDIR=$(dirname "$SCRIPTPATH")
cd "$SCRIPTDIR/.." || exit
if [ "x$1" = "x" ]; then
yarn start
else
yarn start "$PROFILEPATH"
Comment on lines -19 to -21

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yarn start does the switch to root direcotry thing, so probably you didn't need to cd before and after anyway.
But then I believe that relative file paths still wouldn't work without resolving them with realpath first.
Then I believe your change makes sense and is simple enough.
Thanks!

fi
cd "$PWD" || exit
NODE_ENV=development node "$SCRIPTDIR/../server.js" "$@"
4 changes: 4 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ if (localConfigExists) {

const profilerUrl = `http://${host}:${port}`;
if (argv.profile) {
// Needed because of a later working directory change.
argv.profile = path.resolve(argv.profile);

// Spin up a simple http server serving the profile file.
const profileServer = http.createServer((req, res) => {
res.setHeader('Access-Control-Allow-Origin', profilerUrl);
Expand Down Expand Up @@ -124,6 +127,7 @@ if (argv.profile) {
});
}

process.chdir(__dirname); // Allow server.js to be run from anywhere.
const server = new WebpackDevServer(serverConfig, webpack(config));
server
.start()
Expand Down