'Sveltekit nodeadapter build issue

After running npm run build I am getting below message

(!) Some chunks are larger than 500 KiB after minification. Consider:


.svelte-kit/output/client/_app/pages/admin/[email protected] 634.90 KiB / gzip: 199.13 KiB

I found that if I remove below import it works perfect import * as XLSX from 'xlsx/xlsx.mjs';

Any help is appreciated



Solution 1:[1]

That is only a warning, so you can safely ignore it.

This warning exists because chunk size has a big impact on a page's loading time. Serving a lot of Javascript hits you both on bandwidth and CPU, since it means downloading more bytes and interpreting more code.

Ideally you'd be able to minimize the amount of code you ship to your users. This can usually be accomplished by paying attention to code you write and being selective about your dependencies. Big monolithic dependencies are commonly the culprit, and you can often find leaner alternatives.

But sometimes you have a hard requirement for a dependency. If there's no way around it, you have to accept the trade-offs of shipping a big bundle. In that case, you can either ignore the warning or silence it by increasing the kit.vite.build.chunkSizeWarningLimit option in your svelte.config.js. For example:

import adapter from '@sveltejs/adapter-auto';

/** @type {import('@sveltejs/kit').Config} */
const config = {
    kit: {
        adapter: adapter(),

        vite: {
            build: {
                // warn on chunks above 1MB
                chunkSizeWarningLimit: 1024
            }
        }
    }
};

export default config;

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 mrkishi