Skip to content

Commit

Permalink
fix: deploy server assets (#9073)
Browse files Browse the repository at this point in the history
* fix: deploy server assets

* set vite option and fix output dir

* vite 4.1
  • Loading branch information
benmccann authored Feb 16, 2023
1 parent 04db233 commit 6cdf54d
Show file tree
Hide file tree
Showing 31 changed files with 347 additions and 100 deletions.
5 changes: 5 additions & 0 deletions .changeset/cuddly-seals-wait.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

fix: deploy server assets. Only works with Vite 4.1+
2 changes: 1 addition & 1 deletion packages/adapter-static/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"svelte": "^3.55.1",
"typescript": "^4.9.4",
"uvu": "^0.5.6",
"vite": "^4.0.4"
"vite": "^4.1.1"
},
"peerDependencies": {
"@sveltejs/kit": "^1.5.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-static/test/apps/prerendered/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"devDependencies": {
"@sveltejs/kit": "workspace:^",
"svelte": "^3.55.1",
"vite": "^4.0.4"
"vite": "^4.1.1"
},
"type": "module"
}
2 changes: 1 addition & 1 deletion packages/adapter-static/test/apps/spa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@sveltejs/kit": "workspace:^",
"sirv-cli": "^2.0.2",
"svelte": "^3.55.1",
"vite": "^4.0.4"
"vite": "^4.1.1"
},
"type": "module"
}
2 changes: 1 addition & 1 deletion packages/create-svelte/templates/default/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@sveltejs/kit": "workspace:*",
"svelte": "^3.55.1",
"typescript": "^4.9.4",
"vite": "^4.0.0"
"vite": "^4.1.1"
},
"type": "module",
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"svelte-preprocess": "^5.0.0",
"typescript": "^4.9.4",
"uvu": "^0.5.6",
"vite": "^4.0.4"
"vite": "^4.1.1"
},
"peerDependencies": {
"svelte": "^3.54.0",
Expand Down
8 changes: 7 additions & 1 deletion packages/kit/src/core/adapt/builder.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { existsSync, statSync, createReadStream, createWriteStream } from 'node:fs';
import { join } from 'node:path/posix';
import { pipeline } from 'node:stream';
import { promisify } from 'node:util';
import zlib from 'node:zlib';
Expand Down Expand Up @@ -181,7 +182,12 @@ export function create_builder({
},

writeClient(dest) {
return [...copy(`${config.kit.outDir}/output/client`, dest)];
const server_assets = copy(
`${config.kit.outDir}/output/server/${config.kit.appDir}/immutable/assets`,
join(dest, config.kit.appDir, 'immutable/assets')
);
const client_assets = copy(`${config.kit.outDir}/output/client`, dest);
return Array.from(new Set(...server_assets, ...client_assets));
},

// @ts-expect-error
Expand Down
1 change: 1 addition & 0 deletions packages/kit/src/exports/vite/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,7 @@ export function set_assets(path) {
},
preserveEntrySignatures: 'strict'
},
ssrEmitAssets: true,
target: ssr ? 'node16.14' : undefined,
// don't use the default name to avoid collisions with 'static/manifest.json'
manifest: 'vite-manifest.json'
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/test/apps/amp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"svelte": "^3.55.1",
"svelte-check": "^3.0.2",
"typescript": "^4.9.4",
"vite": "^4.0.4"
"vite": "^4.1.1"
},
"type": "module"
}
2 changes: 1 addition & 1 deletion packages/kit/test/apps/basics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"svelte": "^3.55.1",
"svelte-check": "^3.0.2",
"typescript": "^4.9.4",
"vite": "^4.0.4"
"vite": "^4.1.1"
},
"type": "module"
}
2 changes: 1 addition & 1 deletion packages/kit/test/apps/dev-only/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"svelte": "^3.55.1",
"svelte-check": "^3.0.2",
"typescript": "^4.9.4",
"vite": "^4.0.4"
"vite": "^4.1.1"
},
"type": "module"
}
2 changes: 1 addition & 1 deletion packages/kit/test/apps/options-2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"svelte": "^3.55.1",
"svelte-check": "^3.0.2",
"typescript": "^4.9.4",
"vite": "^4.0.4"
"vite": "^4.1.1"
},
"type": "module"
}
2 changes: 1 addition & 1 deletion packages/kit/test/apps/options/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"svelte": "^3.55.1",
"svelte-check": "^3.0.2",
"typescript": "^4.9.4",
"vite": "^4.0.4"
"vite": "^4.1.1"
},
"type": "module"
}
2 changes: 1 addition & 1 deletion packages/kit/test/apps/writes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"svelte": "^3.55.1",
"svelte-check": "^3.0.2",
"typescript": "^4.9.4",
"vite": "^4.0.4"
"vite": "^4.1.1"
},
"type": "module"
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"svelte": "^3.55.1",
"svelte-check": "^3.0.2",
"typescript": "^4.9.4",
"vite": "^4.0.4"
"vite": "^4.1.1"
},
"type": "module"
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"svelte": "^3.55.1",
"svelte-check": "^3.0.2",
"typescript": "^4.9.4",
"vite": "^4.0.4"
"vite": "^4.1.1"
},
"type": "module"
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"svelte": "^3.55.1",
"svelte-check": "^3.0.2",
"typescript": "^4.9.4",
"vite": "^4.0.4"
"vite": "^4.1.1"
},
"type": "module"
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"svelte": "^3.55.1",
"svelte-check": "^3.0.2",
"typescript": "^4.9.4",
"vite": "^4.0.4"
"vite": "^4.1.1"
},
"type": "module"
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"svelte": "^3.55.1",
"svelte-check": "^3.0.2",
"typescript": "^4.9.4",
"vite": "^4.0.4"
"vite": "^4.1.1"
},
"type": "module"
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"svelte": "^3.55.1",
"svelte-check": "^3.0.2",
"typescript": "^4.9.4",
"vite": "^4.0.4"
"vite": "^4.1.1"
},
"type": "module"
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"svelte": "^3.55.1",
"svelte-check": "^3.0.2",
"typescript": "^4.9.4",
"vite": "^4.0.4"
"vite": "^4.1.1"
},
"type": "module"
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"svelte": "^3.55.1",
"svelte-check": "^3.0.2",
"typescript": "^4.9.4",
"vite": "^4.0.4"
"vite": "^4.1.1"
},
"type": "module"
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"svelte": "^3.55.1",
"svelte-check": "^3.0.2",
"typescript": "^4.9.4",
"vite": "^4.0.4"
"vite": "^4.1.1"
},
"type": "module"
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"svelte": "^3.55.1",
"svelte-check": "^3.0.2",
"typescript": "^4.9.4",
"vite": "^4.0.4"
"vite": "^4.1.1"
},
"type": "module"
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"svelte": "^3.55.1",
"svelte-check": "^3.0.2",
"typescript": "^4.9.4",
"vite": "^4.0.4"
"vite": "^4.1.1"
},
"type": "module"
}
2 changes: 1 addition & 1 deletion packages/kit/test/prerendering/basics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"svelte-check": "^3.0.2",
"typescript": "^4.9.4",
"uvu": "^0.5.6",
"vite": "^4.0.4"
"vite": "^4.1.1"
},
"type": "module"
}
2 changes: 1 addition & 1 deletion packages/kit/test/prerendering/options/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"svelte-check": "^3.0.2",
"typescript": "^4.9.4",
"uvu": "^0.5.6",
"vite": "^4.0.4"
"vite": "^4.1.1"
},
"type": "module"
}
2 changes: 1 addition & 1 deletion packages/kit/test/prerendering/paths-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"svelte-check": "^3.0.2",
"typescript": "^4.9.4",
"uvu": "^0.5.6",
"vite": "^4.0.4"
"vite": "^4.1.1"
},
"type": "module"
}
2 changes: 1 addition & 1 deletion packages/kit/test/prerendering/ssr-false/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"svelte-check": "^3.0.2",
"typescript": "^4.9.4",
"uvu": "^0.5.6",
"vite": "^4.0.4"
"vite": "^4.1.1"
},
"type": "module"
}
Loading

0 comments on commit 6cdf54d

Please sign in to comment.