lhapaipai / symfony-vite-dev

Monorepo for symfony-vite development
https://symfony-vite.pentatrion.com
Other
26 stars 22 forks source link

Multiple Vite config doesn't work #44

Closed Webarkitekt closed 1 month ago

Webarkitekt commented 1 month ago

vite-plugin-symfony version

7.0.4

vite-bundle version

7.0.4

your OS, node version, Symfony version, PHP version

No response

Description

When i try to use the multi config settings, it looks like it doesn't work, i get a Symfony error saying that my config doesn't exists.

How to reproduce

Here is my pentatrion_vite.yaml config :

pentatrion_vite:
    default_config: visitme
    builds:
        visitme:
            build_directory: visitme
        now:
            build_directory: now

Possible Solution

If i dump $bundleConfig in src/DependencyInjection/PentatrionViteExtension.php $bundleConfig['builds'] does contains my builds settings $bundleConfig['configs'] is set but doesn't have any value, so this condition isn't true.

if (isset($bundleConfig['builds']) && !isset($bundleConfig['configs'])) {
    $bundleConfig['configs'] = $bundleConfig['builds'];
}

If i dump $bundleConfig['configs'] after the condition, it's empty

lines concerned : https://github.com/lhapaipai/symfony-vite-dev/blob/22afc712f8536360491133339a20930da3c02e38/src/vite-bundle/src/DependencyInjection/PentatrionViteExtension.php#L64

Webarkitekt commented 1 month ago

I just noticed that builds setting is deprecated, so maybe you should update the documentation for multiple configs.

lhapaipai commented 1 month ago

hi @Webarkitekt, yes you totally right, there is an error in the English doc. the option is configs not builds in your pentatrion_vite.yaml.