Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vercel Next js Uncaught (in promise) ChunkLoadError: Loading chunk 0 failed

After deleting node modules and package-lock.json, I am getting the above error, when I reload any page. When I restart the project it works fine for the first time. But again when i reload the page, showing a blank page and giving the above error in the console.

enter image description here

next.config.js

    const withSass = require('@zeit/next-sass')
    const withCSS = require('@zeit/next-css');
    const withFonts = require('next-fonts');
    const withPlugins = require('next-compose-plugins');
    const optimizedImages = require('next-optimized-images');

    module.exports = withPlugins([
        [optimizedImages, {
            inlineImageLimit: 8192,
            imagesFolder: 'images',
            imagesName: '[name]-[hash].[ext]',
            handleImages: ['jpeg', 'jpg', 'png', 'svg', 'webp', 'gif', 'ico'],
            optimizeImages: true,
            optimizeImagesInDev: false,
            mozjpeg: {
                quality: 80,
            },
            optipng: {
                optimizationLevel: 3,
            },
            pngquant: false,
            gifsicle: {
                interlaced: true,
                optimizationLevel: 3,
            },
            webp: {
                preset: 'default',
                quality: 75,
            },
        }],
        [withCSS],[withFonts],[withSass]
    ]);
like image 480
try on Avatar asked Jan 23 '21 11:01

try on


1 Answers

Try removing the .next directory. That is what worked for me :)

like image 89
Spandan Joshi Avatar answered Nov 12 '22 17:11

Spandan Joshi