From e2c5bbd078c44a985bd16c400acd8a79f7f23592 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ey=C3=BE=C3=B3r=20Magn=C3=BAsson?= Date: Thu, 6 Dec 2018 17:22:29 +0100 Subject: [PATCH] fix(dashboard): fix contants import in setupProxy.js --- garden-dashboard/src/constants.js | 14 ++++++++++++++ garden-dashboard/src/constants.ts | 9 --------- garden-dashboard/src/setupProxy.js | 4 ++-- 3 files changed, 16 insertions(+), 11 deletions(-) create mode 100644 garden-dashboard/src/constants.js delete mode 100644 garden-dashboard/src/constants.ts diff --git a/garden-dashboard/src/constants.js b/garden-dashboard/src/constants.js new file mode 100644 index 0000000000..632a369a99 --- /dev/null +++ b/garden-dashboard/src/constants.js @@ -0,0 +1,14 @@ +/* + * Copyright (C) 2018 Garden Technologies, Inc. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +// NOTE: This file only supports Node's JavaScript syntax because it's imported by setupProxy.js. +// See: https://facebook.github.io/create-react-app/docs/proxying-api-requests-in-development#configuring-the-proxy-manually + +module.exports = { + GARDEN_SERVICE_DEFAULT_PORT: 9777 +} diff --git a/garden-dashboard/src/constants.ts b/garden-dashboard/src/constants.ts deleted file mode 100644 index 3b878ec831..0000000000 --- a/garden-dashboard/src/constants.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright (C) 2018 Garden Technologies, Inc. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -export const GARDEN_SERVICE_DEFAULT_PORT = 9777 diff --git a/garden-dashboard/src/setupProxy.js b/garden-dashboard/src/setupProxy.js index 398d8468b6..94eabe094e 100644 --- a/garden-dashboard/src/setupProxy.js +++ b/garden-dashboard/src/setupProxy.js @@ -9,11 +9,11 @@ // Proxy requests from the development server to the correct port on the garden-service server. // See: https://facebook.github.io/create-react-app/docs/proxying-api-requests-in-development#configuring-the-proxy-manually -// NOTE: This file must be named "src/setupProxy.js". +// NOTE: This file must be named "src/setupProxy.js" and only supports Node's Javascript syntax. const proxy = require("http-proxy-middleware") -const { GARDEN_SERVICE_DEFAULT_PORT } = require("constants") +const { GARDEN_SERVICE_DEFAULT_PORT } = require("./constants") module.exports = function(app) { const port = process.env.GARDEN_SERVICE_PORT || GARDEN_SERVICE_DEFAULT_PORT