-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Vite #1179
base: main
Are you sure you want to change the base?
Use Vite #1179
Conversation
…cations for v4 - hot module reloading not yet working
… files can't be in 'public' because vite and play are both opinionated about the purpose of the 'public' directory, leading to shenanigans. Currently there is a problem with the javascript file bundled by vite, possibly because reqwest is causing an issue (we could replace it) # Please enter the commit message for your changes. Lines starting
…moved, and so did reqwest, in order to get the app building properly. Panda requests now use 'fetch' instead. The Search page was accidentally removed in an earlier commit, this reinstates it.
…e's http and ws (non-secure) requests locally by updating our content security policy - is there a better way?
… ensuring that ./scripts/start.sh and ./scripts/client-dev.sh still work
…sx or tsx files because there are unresolved linter problems there that will create lots of noise in this already large PR. This should be addressed in a follow-up PR.
b12fed7
to
087d2c1
Compare
087d2c1
to
e4ff8cb
Compare
15cd1ff
to
bfccb96
Compare
…orkflow' from showing - because getStatus was not expecting the error to look like one returned by fetch
bfccb96
to
a9a8b66
Compare
a9a8b66
to
a8d68b0
Compare
}, | ||
settings: { | ||
react: { | ||
version: 'detect' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this to sort an error when eslint was run.
@@ -2,6 +2,3 @@ name: video | |||
mappings: | |||
- prefix: video | |||
port: 9001 | |||
- prefix: video-assets |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was only used for running the webpack dev server locally.
"lint": "eslint public/video-ui/src/**/*.js", | ||
"build": "tsc && vite build", | ||
"client-dev": "vite", | ||
"lint": "eslint public/video-ui/src/**/** --ext .js,.ts --no-error-on-unmatched-pattern", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also want to match on .jsx and .tsx files - I'll do this in a follow-up as it will create lots of noise in this PR - there are linting errors in files that were previously not matched by the lint command here.
export function pandaReqwest(reqwestBody, timeout = 0) { | ||
const payload = Object.assign({ method: 'get' }, reqwestBody); | ||
export const pandaReqwest = (reqwestBody, timeout = 0) => { | ||
const payload = Object.assign({ method: 'get', credentials: 'include' }, reqwestBody); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could add these credentials only for specific requests - this might be worth doing as a follow-up PR because we'll need to update the application in a lot of places, creating noise in the PR.
74c6f92
to
925d261
Compare
775fa4e
to
477b2c7
Compare
public/video-ui/src/services/pandaReqwest.js - doesn't need to be an exact match
477b2c7
to
6b40a4d
Compare
What does this change?
This PR moves our build and local development server to Vite from Webpack. I have done this for a few reasons:
webpack-dev-server
and otherwebpack
packages - I've spent many hours unsuccessfully trying to bump that package while getting hot reloading to work, or even the current setup (page refresh on local change) and had no luck. I want to sort the vulnerabilities out.What did I change in order to do this?
I did a few things:
9002
used for (faulty?) hot reloadingvite
and some minor config, using it for build (via rollup, under the hood) and the local dev server..js
files containing react to end in.jsx
to make Vite happy (it's also good practice)reqwest
because it wasn't playing nicely with Vite - and we can safely use the nativefetch
api these days anyway.The
reqwest
change is probably the one most likely to generate problems in this PR, it changes the mechanism used by all the requests in the application, and the arguments expected byreqwest
are not the same as those expected byfetch
.I've tested every interaction the client-side application makes with outside services(e.g. Workflow, Targeting and usages) in our CODE environment) and they all seem to be working.
Will there be any follow-up work?
This PR should work by itself, but there will be some tidying as a follow-up. I'd like to:
reqwest
any more.crossOrigin
- and do some other tidying of requests..jsx
and.tsx
files are being linted properly and sort any linting errors.Also, things that predate this PR which I noticed while working on it:
https://workflow.code.dev-gutools.co.uk/api/atom/undefined
on load of a video page - this is obviously unintentional, though it doesn't seem to be causing major problems.How to test
./script/start.sh
locally. Does it start a non-hot reloading server locally? If so, build is working../script/client-dev.sh
locally. Does it start a hot reloading server locally? If so, hot reloading is working.It's also worth testing requests to external services on CODE, where things are wired up better than in local development. Do the Workflow, Targeting and YouTube integrations still work as expected (i.e. do requests in their respective tabs work properly, and does information seem to propagate to those systems?). I can help out with suggestions on testing these integrations, but mostly you'll want to check that you can create and update related settings in related tabs.
Things I tested (you might also want to):
Furniture:
YouTube
Workflow
Usages:
Targeting:
Other:
How can we measure success?