Skip to content

Commit

Permalink
build: Replace CRACO Build/Serve with Vite (#5926)
Browse files Browse the repository at this point in the history
* feat: made first config into compiling work

* get server and build working locally

* add csp support

* remove old index

* check types on build

* prevent out of memory error?

* fix memory leak

* give node more memory

* try applying it here for netlify?

* ensure csphtml plugin runs after all other plugins

* default base url to root?

* undo public url change, record public url

* drop sourcemap from non-prod builds

* remove csp comment

* work around public_url weirdness

* swap react plugin for swc/regen package json

* try removing second node options build for netlify

* temp. restore of vendor/notebook.js

* remove old notebook.js

* update react plugin import

* re-add heap size hack for netlify

* use port 3000

* update eslintignore

* add tsc checking in vite

* remove extraneous spaces from interactive url

* remove react-scripts type

* clean up env types

---------

Co-authored-by: Thiago Dallacqua <[email protected]>
  • Loading branch information
ashtonG and thiagodallacqua-hpe authored Feb 10, 2023
1 parent 3659401 commit 186033a
Show file tree
Hide file tree
Showing 20 changed files with 1,875 additions and 37 deletions.
2 changes: 1 addition & 1 deletion webui/react/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
src/serviceWorker.ts
src/services/api-ts-sdk/
src/vendor/notebook.js
src/vendor/notebook/notebook.js
!.eslintrc.js
!.stylelintrc.js
node_modules
3 changes: 2 additions & 1 deletion webui/react/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Set the path React is going to be served from eg ./ for serving from root.
export PUBLIC_URL ?= /det
export ESLINT_NO_DEV_ERRORS ?= true
export NODE_OPTIONS=--max-old-space-size=6144
source_files := $(shell find src public -type f)

.PHONY: default
Expand All @@ -22,7 +23,7 @@ get-deps: check-requirements node_modules/done.stamp
.PHONY: build
build: check-requirements build/done.stamp

build/done.stamp: $(source_files) node_modules/done.stamp tsconfig.json craco.config.js jest.config.js
build/done.stamp: $(source_files) node_modules/done.stamp tsconfig.json craco.config.js jest.config.js vite.config.ts
npm run build
touch $@

Expand Down
5 changes: 2 additions & 3 deletions webui/react/public/index.html → webui/react/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@

<head>
<meta charset="utf-8" />
<base href="%PUBLIC_URL%">
<meta name="theme-color" content="#000000" />
<meta name="description" content="Determined Deep Learning Training Platform" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, minimal-ui" />
<meta http-equiv="Content-Security-Policy" content="%%CSP_CONTENT%%"/>
<!--
Even though react-helmet-async is dynamically setting favicons,
it is still included here in order for Safari to at least show one.
https://stackoverflow.com/questions/63781987/cant-change-favicon-with-javascript-in-safari
-->
<link rel="shortcut icon" type="image/x-icon" href="%PUBLIC_URL%/determined/favicon.ico" />
<link rel="shortcut icon" type="image/x-icon" href="/determined/favicon.ico" />
<title>Determined</title>
</head>

Expand All @@ -27,6 +25,7 @@
}
}();
</script>
<script type="module" src="/src/index.tsx"></script>
</body>

</html>
Loading

0 comments on commit 186033a

Please sign in to comment.