Skip to content
This repository was archived by the owner on Jan 16, 2024. It is now read-only.

Commit 51ac8bd

Browse files
authored
Merge pull request #55 from tesler-platform/fix/tesler-ui-sourcemaps
Add tesler-ui source maps for local launch, fix local launch, axios and location typings
2 parents d11ae1d + fd1d097 commit 51ac8bd

File tree

5 files changed

+139
-29
lines changed

5 files changed

+139
-29
lines changed

ui/craco.config.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
module.exports = {
2+
webpack: {
3+
configure: {
4+
module: {
5+
rules: [
6+
/**
7+
* Fix source map of external dependencies (including @tesler-ui/core)
8+
*
9+
* TODO: Remove when https://github.com/facebook/create-react-app/pull/8227 released
10+
*/
11+
{
12+
test: /\.(js|css)$/,
13+
use: ['source-map-loader'],
14+
enforce: 'pre'
15+
}
16+
]
17+
},
18+
/**
19+
* Only relevant when applying some dependecies (e.g. @tesler-ui/core) via symlinks,
20+
* so if you are not working on fixing @tesler-ui/core it can safely be removed
21+
*
22+
* TODO: Revise after https://github.com/facebook/create-react-app/pull/7993
23+
*/
24+
resolve: {
25+
symlinks: false
26+
}
27+
}
28+
}
29+
}

ui/package-lock.json

Lines changed: 94 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ui/package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "0.1.0",
44
"private": true,
55
"scripts": {
6-
"start": "react-scripts start",
6+
"start": "craco start",
77
"build": "react-scripts build && npm run rename",
88
"test": "react-scripts test",
99
"eject": "react-scripts eject",
@@ -12,7 +12,7 @@
1212
"rename": "node -e \"require('fs').rename('build/index.html', 'build/index.ftl', function(err) { if (err) console.log(err); console.log('index.ftl formed') })\""
1313
},
1414
"dependencies": {
15-
"@tesler-ui/core": "1.30.3",
15+
"@tesler-ui/core": "1.33.1",
1616
"@testing-library/jest-dom": "^5.14.1",
1717
"@testing-library/react": "^10.4.9",
1818
"@testing-library/user-event": "^10.4.1",
@@ -22,7 +22,7 @@
2222
"@types/react-dom": "^16.9.13",
2323
"@types/react-redux": "^7.1.16",
2424
"antd": "^3.26.20",
25-
"axios": "^0.19.2",
25+
"axios": "0.19.0",
2626
"classnames": "^2.3.1",
2727
"keycloak-js": "^14.0.0",
2828
"react": "^17.0.2",
@@ -61,9 +61,11 @@
6161
},
6262
"homepage": ".",
6363
"devDependencies": {
64+
"craco": "0.0.3",
6465
"eslint-config-prettier": "^8.3.0",
6566
"eslint-plugin-prettier": "^3.4.0",
6667
"http-proxy-middleware": "^2.0.1",
67-
"prettier": "^2.3.2"
68+
"prettier": "^2.3.2",
69+
"source-map-loader": "0.2.4"
6870
}
6971
}

ui/src/reducers/router.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export default function dataReducer(
3434
*
3535
* @param loc
3636
*/
37-
export function keycloakAwareParseLocation(loc: Location): Route {
37+
export function keycloakAwareParseLocation(loc: typeof historyObj.location): Route {
3838
let path: string = loc.pathname
3939
if (path.startsWith('/')) {
4040
path = path.substring(1)

ui/src/setupProxy.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
const { createProxyMiddleware } = require('http-proxy-middleware');
1+
const { createProxyMiddleware } = require('http-proxy-middleware')
22

3-
module.exports = function(app) {
4-
app.use(
5-
'/api/v1',
6-
createProxyMiddleware({
7-
target: 'http://localhost:8080'
8-
})
9-
);
10-
};
3+
module.exports = function (app) {
4+
app.use(
5+
'/api/v1',
6+
createProxyMiddleware({
7+
target: 'http://localhost:8080'
8+
})
9+
)
10+
}

0 commit comments

Comments
 (0)