Skip to content

Commit

Permalink
optimised wasm file size
Browse files Browse the repository at this point in the history
  • Loading branch information
sauraww committed Sep 4, 2024
1 parent e205e71 commit 8312c06
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
4 changes: 2 additions & 2 deletions crates/frontend/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ pub fn app(app_envs: Envs) -> impl IntoView {
<link
rel="preload"
href=wasm_href.clone()
as_="fetch"
type_="application/wasm"
_as="fetch"
_type="application/wasm"
crossorigin=""
/>
<link rel="modulepreload" href=js_href.clone()/>
Expand Down
4 changes: 3 additions & 1 deletion crates/superposition/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use actix_web::dev::Service;
use actix_web::web::PathConfig;
use actix_web::HttpMessage;
use actix_web::middleware::Compress;
use actix_web::{web, web::get, web::scope, web::Data, App, HttpResponse, HttpServer};
use context_aware_config::api::*;
use context_aware_config::helpers::get_meta_schema;
Expand Down Expand Up @@ -154,7 +155,8 @@ async fn main() -> Result<()> {
let site_root = &leptos_options.site_root;
let leptos_envs = ui_envs.clone();
let cac_host = cac_host.to_owned() + base.as_str();
App::new()
App::new()
.wrap(Compress::default())
.wrap_fn(|req, srv| {
let user = User::default();
req.extensions_mut().insert::<User>(user);
Expand Down
15 changes: 14 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ services:
network_mode: bridge

localstack:
build : ./docker-compose/localstack/
build: ./docker-compose/localstack/
container_name: superposition_localstack
ports:
- "4510-4559:4510-4559" # external service port range
Expand All @@ -24,3 +24,16 @@ services:
LOCALSTACK_SERVICES: s3, sns, sqs, logs, cloudwatch, kms
AWS_DEFAULT_REGION: ap-south-1
EDGE_PORT: 4566

app:
image: superposition_github:latest
container_name: superposition_app
ports:
- "8080:8080"
env_file:
- .env
depends_on:
- postgres
- localstack
network_mode: bridge
restart: on-failure
2 changes: 1 addition & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ superposition_dev:

frontend:
cd crates/frontend && \
wasm-pack build --target=web --debug --no-default-features --features=hydrate
wasm-pack build --target web --dev --no-default-features --features hydrate
cd crates/frontend && \
npx tailwindcss -i ./styles/tailwind.css -o ./pkg/style.css
-rm -rf target/site
Expand Down

0 comments on commit 8312c06

Please sign in to comment.