PLEASE help us help you by writing a good post!
- we need to know your netlify site name.
user-credits.netlify.app
- DNS issues? Tell us the custom domain, tell us the error message! We can’t help if we don’t know your domain.
https://user-credits.dev/ - Build problems? Link or paste the FULL build log & build settings screenshot
The project I’m trying to publish is an open source project in SvelteKit here’s it github page
When I run it locally everything works as expected
pnpm i & pnpm dev
// or
pnpm i & pnpm build & pnpm preview
On the deployed server everything works too.
But
netlify dev
I get the errors:
Error: Not found: /_app%5Cimmutable%5Cassets%5C0.c72471a7.css
at resolve (C:\Users\zhamd\work\svelte-user-credits\node_modules\.pnpm\@sveltejs+kit@1.27.4_svelte@4.2.3_vite@4.5.0\node_modules\@sveltejs\kit\src\runtime\server\respond.js:483:13)
at resolve (C:\Users\zhamd\work\svelte-user-credits\node_modules\.pnpm\@sveltejs+kit@1.27.4_svelte@4.2.3_vite@4.5.0\node_modules\@sveltejs\kit\src\runtime\server\respond.js:277:5)
at Object.handle (C:\Users\zhamd\work\svelte-user-credits\src\hooks.server.ts:6:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Module.respond (C:\Users\zhamd\work\svelte-user-credits\node_modules\.pnpm\@sveltejs+kit@1.27.4_svelte@4.2.3_vite@4.5.0\node_modules\@sveltejs\kit\src\runtime\server\respond.js:274:20)
at async file:///C:/Users/zhamd/work/svelte-user-credits/node_modules/.pnpm/@sveltejs+kit@1.27.4_svelte@4.2.3_vite@4.5.0/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js:510:22
Error: Not found: /_app%5Cimmutable%5Cchunks%5CresolverContext.c0557f3d.js
at resolve (C:\Users\zhamd\work\svelte-user-credits\node_modules\.pnpm\@sveltejs+kit@1.27.4_svelte@4.2.3_vite@4.5.0\node_modules\@sveltejs\kit\src\runtime\server\respond.js:483:13)
at resolve (C:\Users\zhamd\work\svelte-user-credits\node_modules\.pnpm\@sveltejs+kit@1.27.4_svelte@4.2.3_vite@4.5.0\node_modules\@sveltejs\kit\src\runtime\server\respond.js:277:5)
at Object.handle (C:\Users\zhamd\work\svelte-user-credits\src\hooks.server.ts:6:15)
The site displays and works locally but without any css
To be able to run this project, you’ll have to provide a .env file with the following constants:
STRIPE_PUBLIC_KEY=pk_live_(XYZ)
STRIPE_PRIVATE_KEY=sk_live_(XYZ)
STRIPE_API_VERSION=2023-08-16
DB_URL=mongodb+srv://(yourdb)
DB_NAME=user-credits
CURRENCY=usd
All the following resources are available in the github repo but I’ll paste them here for readability:
// selte.config.js
import adapter from '@sveltejs/adapter-netlify';
import { vitePreprocess } from '@sveltejs/kit/vite';
/** @type {import('@sveltejs/kit').Config} */
const config = {
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
// for more information about preprocessors
preprocess: [vitePreprocess({})],
resolve: {
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json'],
},
kit: {
// default options are shown
adapter: adapter({
// if true, will create a Netlify Edge Function rather
// than using standard Node-based functions
edge: false,
// if true, will split your app into multiple functions
// instead of creating a single one for the entire app.
// if `edge` is true, this option cannot be used
split: false
})
}
};
export default config;
// vite.config.ts
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vitest/config';
export default defineConfig({
plugins: [sveltekit()],
test: {
include: ['src/**/*.{test,spec}.{js,ts}']
},
build: {
target: 'es2020',
},
});