How to solve "MIME type" errors in deployed canisters?

I have deployed a canister at https://qtz77-4yaaa-aaaao-a2hya-cai.icp0.io/. The repo for the local version is here. I’ve made only minor changes to adapt it for IC deployment. The page displays correctly but none of the features work. Included in the console output is this:

sw.ts:64 Direct call ...
qtz77-4yaaa-aaaao-a2hya-cai.icp0.io/:1  Refused to apply style from 
'https://qtz77-4yaaa-aaaao-a2hya-cai.icp0.io/assets/main.css' because 
its MIME type ('text/html') is not a supported stylesheet MIME type, 
and strict MIME checking is enabled.
qtz77-4yaaa-aaaao-a2hya-cai.icp0.io/:1  Refused to execute script from 
'https://qtz77-4yaaa-aaaao-a2hya-cai.icp0.io/src/index.js' because its 
MIME type ('text/html') is not executable, and strict MIME type checking 
is enabled.
index.js:2  Uncaught (in promise) TypeError: Failed to execute 'compile' 
on 'WebAssembly': Incorrect response MIME type. Expected 'application/wasm'.

I’ve searched for solutions but can’t find anything that appears to solve it. Can anyone help with some advice?

I’ve put in place this set of changes, helpfully recommended by AdamS in the ICP Developer Community Discord:

You’ve set up your URLs wrong.
The assets dir is not a component of your URLs. assets contains static data, and is served from the root, same as generated data does not have dist in the URL.
And then you’ve set a script to be imported from /src , which isn’t included in the assets container at all, and which is superfluous; the bundler converts your JS code to a single file that’s already being loaded in <head> for you.
Delete the <script> tag from the <body> , and change the <link> tag to point to /main.css .

The CSS and embedded image now display correctly but still nothing is functioning. I also tried removing all references to the internet_identity canister since this is not needed in the IC version, and deleted and re-deployed the full set of canisters. It now just gives this one error:

image

This frontend (one of two) is now deployed at https://qb7ig-qiaaa-aaaao-a2h3a-cai.icp0.io/.