Skip to content

Commit

Permalink
[chore] trigger sync and other setup from plugin (#5067)
Browse files Browse the repository at this point in the history
* [chore] trigger sync and other setup from plugin

* format

Co-authored-by: Rich Harris <hello@rich-harris.dev>
  • Loading branch information
benmccann and Rich-Harris authored May 25, 2022
1 parent 31a9e0e commit bec50ed
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/odd-bottles-drop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

[chore] trigger sync and other setup from plugin
3 changes: 0 additions & 3 deletions packages/kit/src/core/dev/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { deep_merge } from '../../utils/object.js';
import { load_config, print_config_conflicts } from '../config/index.js';
import { get_aliases, get_runtime_path } from '../utils.js';
import { create_plugin } from './plugin.js';
import * as sync from '../sync/sync.js';

const cwd = process.cwd();

Expand All @@ -23,8 +22,6 @@ export async function dev({ port, host, https }) {
/** @type {import('types').ValidatedConfig} */
const config = await load_config();

sync.init(config);

const [vite_config] = deep_merge(
{
server: {
Expand Down
18 changes: 10 additions & 8 deletions packages/kit/src/core/dev/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,21 @@ const cwd = process.cwd();
* @returns {Promise<import('vite').Plugin>}
*/
export async function create_plugin(config) {
const runtime = get_runtime_path(config);

process.env.VITE_SVELTEKIT_APP_VERSION_POLL_INTERVAL = '0';

/** @type {import('types').Respond} */
const respond = (await import(`${runtime}/server/index.js`)).respond;

return {
name: 'vite-plugin-svelte-kit',

configureServer(vite) {
async configureServer(vite) {
installPolyfills();

sync.init(config);

const runtime = get_runtime_path(config);

process.env.VITE_SVELTEKIT_APP_VERSION_POLL_INTERVAL = '0';

/** @type {import('types').Respond} */
const respond = (await import(`${runtime}/server/index.js`)).respond;

/** @type {import('types').SSRManifest} */
let manifest;

Expand Down

0 comments on commit bec50ed

Please sign in to comment.