WithCandour / statamic-aardvark-seo

Candour's SEO addon for Statamic
https://statamic.com/marketplace/addons/aardvark-seo
11 stars 18 forks source link

Control panel not working due to addon #184

Open geertjanknapen1 opened 1 month ago

geertjanknapen1 commented 1 month ago

Heya folks, I've recently updated to Laravel 11 and Statamic 5. But now, whenever I try to access the control panel, I run into the following issue:

Vite manifest not found at: /usr/share/nginx/html/public/vendor/aardvark-seo/build/manifest.json
(View: /usr/share/nginx/html/vendor/statamic/cms/resources/views/partials/scripts.blade.php)
(View: /usr/share/nginx/html/vendor/statamic/cms/resources/views/partials/scripts.blade.php)
(View: /usr/share/nginx/html/vendor/statamic/cms/resources/views/partials/scripts.blade.php)

I saw the addon was updated to use Vite, instead of Webpack. I'm still using Webpack, could that be the problem.

I've set-up my webpack.mix.js file as follows:

const mix = require('laravel-mix');
const path = {
    node_modules: 'node_modules/',
    sourceResources: 'resources/',
    sourceVendor: 'vendor/',
    destPublic: 'public/',
    destStorage: 'public/storage/',
    destVendor: 'public/vendor/',
};

// ...
// other stuff
// ...

mix.copyDirectory(path.sourceVendor + 'withcandour/aardvark-seo/resources/', path.destVendor + 'aardvark-seo')

Update

Even when I remove mix.copyDirectory(path.sourceVendor + 'withcandour/aardvark-seo/resources/', path.destVendor + 'aardvark-seo') from the webpack.mix.js file, or replace it with the following .copyDirectory(path.sourceVendor + 'withcandour/aardvark-seo/resources/dist', path.destVendor + 'aardvark-seo/build'), the error keeps persisting.

geertjanknapen1 commented 1 month ago

Update 2

I can get around it (once) by deleting vendor/withcandour and then running composer install.

But the moment I run npm run dev again, I am greeted by the same Vite manifest error again.

geertjanknapen1 commented 1 month ago

Seems to happen due to the CleanWebpackPlugin deleting some things which it shouldn't..

.webpackConfig({
        plugins: [
            new CleanWebpackPlugin({
                dry: false,
                verbose: false,
                cleanOnceBeforeBuildPatterns: [
                    '**/*',
                    '!storage/**',
                    '!index.php',
                    '!robots.txt',
                    '!favicon.ico',
                    '!d/**',
                    '!tds/**',
                ],
            }),
        ],
        output: {
            publicPath: path.destPublic,
        },
        stats: {
            children: true,
        }
    })