Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jenskh's avatar

Generated an empty chunk:

When running npm run build within a Laravel 10 project, most of my js files listed in the vite.config.js compile as expected, yet several result in the following output: Generated an empty chunk: "".

They do appear in the manifest and they do exist in the final asset folder, yet they are empty. The original file is not empty, contains code the website needs/references in one or more blade files.

partial vite.config.js


plugins: [
        laravel({
            input: [
                'resources/css/app.css',
                'resources/js/app.js',
                'resources/js/common/common.js',
                'resources/js/common/moment.js',
                'resources/js/public/bikerequest.js',
                'resources/js/warehouse/outgoing.js',
                'resources/js/warehouse/incoming.js',

Moment.js, outgoing.js, and incoming.js work as expected. bikerequest.js and common.js result in empty chunks.

Any idea on causes and possible solutions? I've found nothing within the Laravel docs, nor the vite docs.

0 likes
2 replies
jenskh's avatar
jenskh
OP
Best Answer
Level 1

Issue resolved. Problem existed between the chair and keyboard. Vite requires es6 modules and I had used non-es6 compliant javascript.

Arman2511's avatar

@jenskh can you explain please, which steps have you done. I have the same problem and i can not solve it

Please or to participate in this conversation.