Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore] trigger sync and other setup from plugin #5067

Merged
merged 2 commits into from
May 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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