I have a Spring Boot back end written in Kotlin, and a front end written in Kotlin and compiled down to WASM.
I’ve got a Docker file that copies over the front end static content to the Spring Boot app:
FROM eclipse-temurin:17-jdk-noble as builder
ARG JAR_FILE=ExceleratorService/build/libs/ExceleratorService.jar
COPY ${JAR_FILE} application.jar
RUN java -Djarmode=layertools -jar application.jar extract
# Create the final image
FROM eclipse-temurin:17-jdk-noble
COPY --from=builder dependencies/ ./
COPY --from=builder snapshot-dependencies/ ./
COPY --from=builder spring-boot-loader/ ./
COPY --from=builder application/ ./
# copy the wasmjs static resources
COPY composeApp/build/dist/wasmJs/productionExecutable /BOOT-INF/classes/static
ENTRYPOINT ["java", "org.springframework.boot.loader.launch.JarLauncher"]
When I try and hit index.html I get this:
skiko.mjs:8 wasm streaming compile failed: TypeError: Failed to
execute ‘compile’ on ‘WebAssembly’: Incorrect response MIME type.
Expected ‘application/wasm’. skiko.mjs:8 falling back to ArrayBuffer
instantiation async module:63 Uncaught (in promise) TypeError: Failed
to execute ‘compile’ on ‘WebAssembly’: Incorrect response MIME type.
Expected ‘application/wasm’.
My understanding was that Spring Boot 3.4 adds support for the wasm mime type, but upgrading to Spring Boot 3.4.0-M2 didn’t fix the problem.
Is there a way to configure Spring Boot to serve “application/wasm” ? My application is a WebFlux one by the way.