Skip to content

Commit

Permalink
Merge branch 'master' into gh-754
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Apr 23, 2021
2 parents c96415d + ba732ff commit a224bfc
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 27 deletions.
21 changes: 9 additions & 12 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
{
"$schema": "https://unpkg.com/@changesets/config@1.4.0/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"linked": [],
"access": "restricted",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": [
"hn.svelte.dev",
"svelte-kit-demo"
]
}
"$schema": "https://unpkg.com/@changesets/config@1.4.0/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"linked": [],
"access": "restricted",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": ["hn.svelte.dev"]
}
5 changes: 5 additions & 0 deletions .changeset/lazy-carpets-join.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

Report errors in hooks.js
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,4 @@ jobs:
${{ runner.os }}-${{ matrix.node-version }}
- run: npm install -g pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm build && pnpm build --filter="svelte-kit-demo" --filter="hn.svelte.dev"
- run: pnpm build && pnpm build --filter="hn.svelte.dev"
6 changes: 5 additions & 1 deletion packages/create-svelte/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@
/cli/versions.js

/templates/*/.svelte
/templates/*/build
/templates/*/build
/templates/*/.cloudflare
/templates/*/.vercel_build_output
/templates/*/.netlify
/templates/*/dist
21 changes: 8 additions & 13 deletions packages/kit/src/core/dev/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { create_app } from '../../core/create_app/index.js';
import { rimraf } from '../filesystem/index.js';
import { respond } from '../../runtime/server/index.js';
import { getRawBody } from '../http/index.js';
import { copy_assets, get_no_external } from '../utils.js';
import { copy_assets, get_no_external, resolve_entry } from '../utils.js';
import svelte from '@sveltejs/vite-plugin-svelte';
import { get_server } from '../server/index.js';
import '../../install-fetch.js';
Expand Down Expand Up @@ -136,19 +136,13 @@ class Watcher extends EventEmitter {

if (req.url === '/favicon.ico') return;

const hooks = /** @type {import('types/internal').Hooks} */ (await this.vite
.ssrLoadModule(`/${this.config.kit.files.hooks}`)
.catch(() => ({})));
/** @type {import('types/internal').Hooks} */
const hooks = resolve_entry(this.config.kit.files.hooks)
? await this.vite.ssrLoadModule(`/${this.config.kit.files.hooks}`)
: {};

let root;

try {
root = (await this.vite.ssrLoadModule(`/${this.dir}/generated/root.svelte`)).default;
} catch (e) {
res.statusCode = 500;
res.end(e.stack);
return;
}
const root = (await this.vite.ssrLoadModule(`/${this.dir}/generated/root.svelte`))
.default;

const rawBody = await getRawBody(req);

Expand Down Expand Up @@ -297,6 +291,7 @@ class Watcher extends EventEmitter {
}
} catch (e) {
this.vite.ssrFixStacktrace(e);
res.statusCode = 500;
res.end(e.stack);
}
});
Expand Down

0 comments on commit a224bfc

Please sign in to comment.