SvelteKit v1.0.0-next.304 is suddenly executing code during build, prerender problem?
See original GitHub issueDescribe the bug
I am building a full stack SvelteKit adapter-node application with database connection. It is build in a container to be run in a container. Todays npm update killed my build process because npm run build started to execute my source code.
So far this would build, but with SvelteKit v1.0.0-next.304 (and its dependencies) build started to fail:
// hooks.ts
export const handle = async ({ event, resolve }) => {
// simulate crash because DB can not be connected
// without credentials and access during build process
console.log('Going to simulate crash')
process.exit();
const response = await resolve(event);
return response;
};
My last good npm update was 3 days ago.
Note: The build process always worked, but I had to use npm ci --production --ignore-scripts later with the built code.
This may have to do with the pre-rendering, but I have not touched those settings.
Reproduction
https://stackblitz.com/edit/sveltejs-kit-template-default-9crzvj?file=src%2Fhooks.js
const config = {
kit: {
prerender: {
enabled: false
}
}
}
Run npm run build and it will execute the code and exit the process
Logs
No response
System Info
WORKS
System:
OS: macOS 12.2.1
CPU: (8) arm64 Apple M1
Memory: 105.05 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.19.0 - /opt/homebrew/opt/node@14/bin/node
npm: 6.14.16 - /opt/homebrew/opt/node@14/bin/npm
Browsers:
Chrome: 100.0.4896.60
Firefox: 98.0.2
Safari: 15.3
npmPackages:
@sveltejs/adapter-auto: ^1.0.0-next.33 => 1.0.0-next.33
@sveltejs/adapter-node: ^1.0.0-next.73 => 1.0.0-next.73
@sveltejs/kit: ^1.0.0-next.303 => 1.0.0-next.303
svelte: ^3.46.0 => 3.46.4
WORKS NOT ANYMORE
npmPackages:
@sveltejs/adapter-auto: ^1.0.0-next.34 => 1.0.0-next.34
@sveltejs/adapter-node: ^1.0.0-next.73 => 1.0.0-next.73
@sveltejs/kit: ^1.0.0-next.304 => 1.0.0-next.304
svelte: ^3.46.6 => 3.46.6
Severity
blocking an upgrade
Additional Information
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:10
- Comments:33 (24 by maintainers)

Top Related StackOverflow Question
Bugs eventually squeeze in unnoticed, and being on the
@nextedge of a fast-changing prerelease library means you’ll eventually hit them. We welcome collaboration on getting things fixed, but pointing out how obvious a bug is from your perspective doesn’t help anyone.I’m bumping this to
p0-urgent, but please let’s strive to keep the discussion constructive—adding a thumbs up to the issue is enough to signal you were (unfortunately) affected by it.By the way, I think the p0-urgent label is more appropriate for this. It’s breaking a lot of people’s stuff.