diff --git a/client/build.gradle.kts b/client/build.gradle.kts index 45a74e04..772a7d9e 100644 --- a/client/build.gradle.kts +++ b/client/build.gradle.kts @@ -61,18 +61,19 @@ kotlin { port = 8080 } } - testTask { - // Disable browser tests due to ChromeHeadless permission issues - enabled = false + runTask { + // Development optimizations + args.add("--mode=development") + //args.add("--optimization-minimize=false") } webpackTask { // Production optimizations args.add("--mode=production") args.add("--optimization-minimize") } - runTask { - // Development optimizations - args.add("--mode=development") + testTask { + // Disable browser tests due to ChromeHeadless permission issues + enabled = false } } @@ -96,20 +97,25 @@ kotlin { enabled.set(true) } // WASM-specific webpack optimizations handled by webpack.config.d files + devServer?.apply { + open = false + port = 8080 + } } - testTask { - // Disable WASM browser tests due to environment issues - enabled = false + runTask { + // Development optimizations for WASM + args.add("--mode=development") + //args.add("--optimization-minimize=false") + // Dev server settings handled by webpack.config.d/dev-server.js } webpackTask { // Production optimizations for WASM args.add("--mode=production") args.add("--optimization-minimize") } - runTask { - // Development optimizations for WASM - args.add("--mode=development") - // Dev server settings handled by webpack.config.d/dev-server.js + testTask { + // Disable WASM browser tests due to environment issues + enabled = false } } diff --git a/client/src/wasmJsMain/resources/index.html b/client/src/commonMain/resources/index.html similarity index 55% rename from client/src/wasmJsMain/resources/index.html rename to client/src/commonMain/resources/index.html index e10092b7..b29bad57 100644 --- a/client/src/wasmJsMain/resources/index.html +++ b/client/src/commonMain/resources/index.html @@ -8,10 +8,5 @@ - - - - - diff --git a/client/src/jsMain/resources/styles.css b/client/src/commonMain/resources/styles.css similarity index 100% rename from client/src/jsMain/resources/styles.css rename to client/src/commonMain/resources/styles.css diff --git a/client/src/jsMain/kotlin/at/mocode/main.kt b/client/src/jsMain/kotlin/at/mocode/main.kt index 21580035..b92bf62a 100644 --- a/client/src/jsMain/kotlin/at/mocode/main.kt +++ b/client/src/jsMain/kotlin/at/mocode/main.kt @@ -1,16 +1,11 @@ package at.mocode import androidx.compose.ui.ExperimentalComposeUiApi -import androidx.compose.ui.window.ComposeViewport -import kotlinx.browser.document +import androidx.compose.ui.window.CanvasBasedWindow @OptIn(ExperimentalComposeUiApi::class) fun main() { - - ComposeViewport(document.getElementById("ComposeTarget")!!) { + CanvasBasedWindow(canvasElementId = "ComposeTarget") { App() } -// CanvasBasedWindow(canvasElementId = "ComposeTarget") { -// App() -// } } diff --git a/client/src/jsMain/resources/index.html b/client/src/jsMain/resources/index.html deleted file mode 100644 index 9f5978e3..00000000 --- a/client/src/jsMain/resources/index.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - Meldestelle - - - -
- - - - - - - diff --git a/client/src/wasmJsMain/kotlin/at/mocode/main.kt b/client/src/wasmJsMain/kotlin/at/mocode/main.kt index a19644a5..b92bf62a 100644 --- a/client/src/wasmJsMain/kotlin/at/mocode/main.kt +++ b/client/src/wasmJsMain/kotlin/at/mocode/main.kt @@ -5,11 +5,6 @@ import androidx.compose.ui.window.CanvasBasedWindow @OptIn(ExperimentalComposeUiApi::class) fun main() { - -// ComposeViewport(document.getElementById("ComposeTarget")!!) { -// App() -// } - CanvasBasedWindow(canvasElementId = "ComposeTarget") { App() } diff --git a/client/src/wasmJsMain/resources/styles.css b/client/src/wasmJsMain/resources/styles.css deleted file mode 100644 index 0549b10f..00000000 --- a/client/src/wasmJsMain/resources/styles.css +++ /dev/null @@ -1,7 +0,0 @@ -html, body { - width: 100%; - height: 100%; - margin: 0; - padding: 0; - overflow: hidden; -} \ No newline at end of file diff --git a/client/webpack.config.d/dev-server.js b/client/webpack.config.d/dev-server.js index 40340978..74bcfad4 100644 --- a/client/webpack.config.d/dev-server.js +++ b/client/webpack.config.d/dev-server.js @@ -1,5 +1,6 @@ // Development server configuration with API proxy // This forwards API requests from webpack-dev-server to the gateway +const path = require('path'); if (config.mode !== 'production') { config.devServer = { @@ -33,7 +34,7 @@ if (config.mode !== 'production') { // Static files configuration static: { - directory: 'src/commonMain/resources', + directory: path.resolve(__dirname, '../../build/dist/wasmJs/developmentExecutable'), serveIndex: true, watch: true }, diff --git a/client/webpack.config.d/wasm-optimization.js b/client/webpack.config.d/wasm-optimization.js index fee9609a..944edb9c 100644 --- a/client/webpack.config.d/wasm-optimization.js +++ b/client/webpack.config.d/wasm-optimization.js @@ -1,14 +1,13 @@ // WASM Bundle Size Optimization Configuration // Advanced Webpack configuration for smaller WASM bundles - -const path = require('path'); +//const path = require('path'); // Bundle size optimization configuration config.optimization = { ...(config.optimization || {}), // Enable aggressive tree shaking usedExports: true, - sideEffects: false, + sideEffects: true, // Split chunks for better caching and smaller initial bundle splitChunks: {