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

datarecall's avatar

Webpack: Trying To Deploy Over Asset Limit

I am over my assets amount of 300 when uploading to vapor so I changed my webpack.mix.js file to :

const mix = require('laravel-mix');
var S3Plugin = require('webpack-s3-plugin')

/*
 |--------------------------------------------------------------------------
 | Mix Asset Management
 |--------------------------------------------------------------------------
 |
 | Mix provides a clean, fluent API for defining some Webpack build steps
 | for your Laravel application. By default, we are compiling the Sass
 | file for the application as well as bundling up all the JS files.
 |
 */

mix.js('resources/js/app.js', 'public/assets/js')
    .sass('resources/sass/app.scss', 'public/assets/css')
    .copyDirectory('resources/img', 'public/assets/img')
    .version();

if (mix.inProduction()) {
    mix.version();
    mix.webpackConfig({
        plugins: [
            new S3Plugin({
                // Exclude uploading of html
                exclude: /.*\.html$/,
                // s3Options are required
                s3Options: {
                    accessKeyId: process.env.AWS_ACCESS_KEY_ID,
                    secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
                    region: process.env.AWS_DEFAULT_REGION
                },
                s3UploadOptions: {
                    Bucket: process.env.AWS_BUCKET,
                    CacheControl: 'public, max-age=31536000'
                },
                directory: 'public/assets'
            })
        ]
    });
}

if (mix.inProduction()) {
    const ASSET_URL = process.env.ASSET_URL + "/";

    mix.webpackConfig(webpack => {
        return {
            plugins: [
                new webpack.DefinePlugin({
                    "process.env.ASSET_PATH": JSON.stringify(ASSET_URL)
                })
            ],
            output: {
                publicPath: ASSET_URL
            }
        };
    });
}

This uploads all my asset files to amazon s3 however since the files are still there they are trying to deploy to vapor as well, any thoughts on how I can "clean" this directory after the upload but prior to deploying to vapor ?

0 likes
0 replies

Please or to participate in this conversation.