diff --git a/.eslintignore b/.eslintignore index 54f42aa52ac2c6883b9761050670aad289a33243..633911264896d73603d8dbcaa2d02d2e941c2dd5 100644 --- a/.eslintignore +++ b/.eslintignore @@ -8,3 +8,4 @@ keys/ logs/ static/ templates/ +*/webpack.config.js \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 7dfb735f3ac95d5bdb30d1f6023ccaa1e4c163ea..c512e0afb67eff4f652d7cd40a53556cce44deb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Updated manifest format, added meta with related images () - Update of COCO format documentation () +- Updated Webpack Dev Server config to add proxxy () ### Deprecated diff --git a/cvat-core/src/config.js b/cvat-core/src/config.js index 93d9577936c4cbbe559ea20a8a8167f082618a7c..3dcddc2b2a6679105952486bdd13e08c39de5a3f 100644 --- a/cvat-core/src/config.js +++ b/cvat-core/src/config.js @@ -1,8 +1,8 @@ -// Copyright (C) 2019-2020 Intel Corporation +// Copyright (C) 2019-2021 Intel Corporation // // SPDX-License-Identifier: MIT module.exports = { - backendAPI: 'http://localhost:7000/api/v1', + backendAPI: '/api/v1', proxy: false, }; diff --git a/cvat-ui/package-lock.json b/cvat-ui/package-lock.json index f28478733f90120959c9cbe6b0a62c903874e01f..8df2dcbb3ed7eddd31c23393c3e692f4638a35dd 100644 --- a/cvat-ui/package-lock.json +++ b/cvat-ui/package-lock.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.20.5", + "version": "1.20.6", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/cvat-ui/package.json b/cvat-ui/package.json index 521a70e5330c3e1e607d1f813476285e2e0173d8..12d141fd8c6ee09aa1e4ba6c94fcc549177c0d38 100644 --- a/cvat-ui/package.json +++ b/cvat-ui/package.json @@ -1,11 +1,11 @@ { "name": "cvat-ui", - "version": "1.20.5", + "version": "1.20.6", "description": "CVAT single-page application", "main": "src/index.tsx", "scripts": { "build": "webpack --config ./webpack.config.js", - "start": "REACT_APP_API_URL=http://localhost:7000 webpack-dev-server --config ./webpack.config.js --mode=development", + "start": "webpack-dev-server --env.API_URL=http://localhost:7000 --config ./webpack.config.js --mode=development", "type-check": "tsc --noEmit", "type-check:watch": "npm run type-check -- --watch", "lint": "eslint './src/**/*.{ts,tsx}'", diff --git a/cvat-ui/src/cvat-core-wrapper.ts b/cvat-ui/src/cvat-core-wrapper.ts index 66bbb3ac2c99127cc33e510aa21a7dd8896ff5b8..f62cde272b5f47551757fd2448c1e977932d64a0 100644 --- a/cvat-ui/src/cvat-core-wrapper.ts +++ b/cvat-ui/src/cvat-core-wrapper.ts @@ -1,4 +1,4 @@ -// Copyright (C) 2020 Intel Corporation +// Copyright (C) 2020-2021 Intel Corporation // // SPDX-License-Identifier: MIT @@ -6,8 +6,7 @@ import _cvat from 'cvat-core/src/api'; const cvat: any = _cvat; -cvat.config.backendAPI = - typeof process.env.REACT_APP_API_URL === 'undefined' ? '/api/v1' : `${process.env.REACT_APP_API_URL}/api/v1`; +cvat.config.backendAPI = '/api/v1'; export default function getCore(): any { return cvat; diff --git a/cvat-ui/webpack.config.js b/cvat-ui/webpack.config.js index 50c13cfee39f1d8439be3d049d55d26e44465799..f99c03cb91dad01ed4bc7dcad0558aa6f1b95481 100644 --- a/cvat-ui/webpack.config.js +++ b/cvat-ui/webpack.config.js @@ -1,4 +1,4 @@ -// Copyright (C) 2020 Intel Corporation +// Copyright (C) 2020-2021 Intel Corporation // // SPDX-License-Identifier: MIT @@ -12,7 +12,7 @@ const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin'); const Dotenv = require('dotenv-webpack'); const CopyPlugin = require('copy-webpack-plugin'); -module.exports = { +module.exports = (env) => ({ target: 'web', mode: 'production', devtool: 'source-map', @@ -30,6 +30,17 @@ module.exports = { inline: true, port: 3000, historyApiFallback: true, + proxy: [ + { + context: (param) => + param.match( + /\/api\/.*|git\/.*|opencv\/.*|analytics\/.*|static\/.*|admin(?:\/(.*))?.*|documentation\/.*|django-rq(?:\/(.*))?/gm, + ), + target: env && env.API_URL, + secure: false, + changeOrigin: true, + }, + ], }, resolve: { extensions: ['.tsx', '.ts', '.jsx', '.js', '.json'], @@ -134,4 +145,4 @@ module.exports = { ]), ], node: { fs: 'empty' }, -}; +});