In addition to extending the mime.types nginx config explained above, you’d need to also touch the nginx.conf file config for serving static files - add mjs to the list similarly to the snippet:
# Serve static files
location ~ \.(?:css|js|mjs|svg|gif|png|jpg|ico|wasm|tflite|map|ogg|flac)$ {
try_files $uri /index.php$request_uri;