Skip to content

Commit

Permalink
Upgrade to Vite 3
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann committed May 23, 2022
1 parent 4f3b1db commit 5bb56ce
Show file tree
Hide file tree
Showing 11 changed files with 122 additions and 125 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"prettier": "^2.5.0",
"prettier-plugin-svelte": "^2.5.0",
"rimraf": "^3.0.2",
"rollup": "^2.60.2",
"rollup": "^2.74.1",
"sirv": "^2.0.0",
"svelte": "^3.48.0",
"svelte-check": "^2.5.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-cloudflare-workers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"dependencies": {
"@iarna/toml": "^2.2.5",
"esbuild": "^0.14.29"
"esbuild": "^0.14.39"
},
"devDependencies": {
"@cloudflare/kv-asset-handler": "^0.2.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-cloudflare/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"prepublishOnly": "npm run build"
},
"dependencies": {
"esbuild": "^0.14.29",
"esbuild": "^0.14.39",
"worktop": "0.8.0-next.14"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-netlify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"dependencies": {
"@iarna/toml": "^2.2.5",
"esbuild": "^0.14.29",
"esbuild": "^0.14.39",
"tiny-glob": "^0.2.9"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-vercel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"check": "tsc"
},
"dependencies": {
"esbuild": "^0.14.29"
"esbuild": "^0.14.39"
},
"devDependencies": {
"@sveltejs/kit": "workspace:*"
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@sveltejs/vite-plugin-svelte": "^1.0.0-next.44",
"chokidar": "^3.5.3",
"sade": "^1.7.4",
"vite": "^2.9.9"
"vite": "^3.0.0-alpha.2"
},
"devDependencies": {
"@types/connect": "^3.4.35",
Expand Down
10 changes: 5 additions & 5 deletions packages/kit/src/core/build/build_service_worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ export async function build_service_worker(
prerendered,
client_manifest
) {
const build = new Set();
const build_files = new Set();
for (const key in client_manifest) {
const { file, css = [], assets = [] } = client_manifest[key];
build.add(file);
css.forEach((file) => build.add(file));
assets.forEach((file) => build.add(file));
build_files.add(file);
css.forEach((file) => build_files.add(file));
assets.forEach((file) => build_files.add(file));
}

const service_worker = `${config.kit.outDir}/generated/service-worker.js`;
Expand All @@ -43,7 +43,7 @@ export async function build_service_worker(
};
export const build = [
${Array.from(build)
${Array.from(build_files)
.map((file) => `${s(`${config.kit.paths.base}/${config.kit.appDir}/${file}`)}`)
.join(',\n\t\t\t\t')}
];
Expand Down
11 changes: 6 additions & 5 deletions packages/kit/src/core/dev/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,8 @@ export async function dev({ cwd, port, host, https, config }) {

/** @type {[any, string[]]} */
const [merged_config, conflicts] = deep_merge(vite_config, {
base: '/',
configFile: false,
root: cwd,
resolve: {
alias: get_aliases(config)
},
build: {
rollupOptions: {
// Vite dependency crawler needs an explicit JS entry point
Expand All @@ -73,7 +70,11 @@ export async function dev({ cwd, port, host, https, config }) {
}),
await create_plugin(config, cwd)
],
base: '/'
resolve: {
alias: get_aliases(config)
},
root: cwd,
spa: false
});

print_config_conflicts(conflicts, 'kit.vite.');
Expand Down
3 changes: 0 additions & 3 deletions packages/kit/src/core/dev/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,9 +372,6 @@ function not_found(res, message = 'Not found') {
*/
function remove_html_middlewares(server) {
const html_middlewares = [
'viteIndexHtmlMiddleware',
'vite404Middleware',
'viteSpaFallbackMiddleware',
'viteServeStaticMiddleware'
];
for (let i = server.stack.length - 1; i > 0; i--) {
Expand Down
Loading

0 comments on commit 5bb56ce

Please sign in to comment.