How do I disable minification when running "build" command in sveltekit?
Asked Answered
P

1

17

I am deploying sveltekit to a dfinity container and I need to disable minification to debug.

I have to build a static version to deploy it with npm run build -- is there a vite option to disable minification?

I've tried this: svelte.config.js but it doesn't do anything:

vite: {
    resolve: {
        alias: {
            $components: path.resolve('./src/components'),
            $stores: path.resolve('./src/stores'),
            $api: path.resolve('./src/api')
        }
    },
    build: {
        minify: false
    }
}
Photocopy answered 6/4, 2022 at 13:24 Comment(2)
I cannot reproduce the issue. vite.build.minify=false does actually disable minification in a newly scaffolded SvelteKit project. Can you share a link to a reproduction of the problem?Tailpipe
that works. it still compiled it but did not minify. so we're good.Photocopy
D
18

Use vite.config.js/ts instead, and set the build.minify option:

import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';

export default defineConfig({
    plugins: [sveltekit()],
    build: {
        minify: false
    }
});

Reference

Dull answered 18/3, 2023 at 21:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.