Symfony-UX / Stimulus - Error connecting controller

944 Views Asked by At

I wandet to try the Symfony Cropper UX-Component, but it resulted in an Javascript-Error:

Error connecting controller
TypeError: expected value of type "object" but instead got value "[]" of type "array"
    at object (stimulus.js:1909:1)
    at extended.get (stimulus.js:1789:1)
    at extended.connect (controller.js:14:1)
    at Context.connect (stimulus.js:1086:1)
    at Module.connectContextForScope (stimulus.js:1278:1)
    at stimulus.js:1606:1
    at Array.forEach (<anonymous>)
    at Router.connectModule (stimulus.js:1606:1)
    at Router.loadDefinition (stimulus.js:1569:1)
    at stimulus.js:1661:1

{identifier: 'symfony--ux-cropperjs--cropper', controller: extended, element: input#form_crop_options}

My Controller looks like the Example from: https://symfony.com/bundles/ux-cropperjs/current/index.html

My controllers.json looks like this:

{
    "controllers": {
        "@symfony/ux-cropperjs": {
            "cropper": {
                "enabled": true,
                "fetch": "eager",
                "autoimport": {
                    "cropperjs/dist/cropper.min.css": true,
                    "@symfony/ux-cropperjs/src/style.css": true
                }
            }
        }
    },
    "entrypoints": []
}

bootstrap.js like this:

import { startStimulusApp } from '@symfony/stimulus-bridge';

console.log("bootstrapping stimulus...");

// Registers Stimulus controllers from controllers.json and in the controllers/ directory
export const app = startStimulusApp(require.context(
    '@symfony/stimulus-bridge/lazy-controller-loader!./controllers',
    true,
    /\.[jt]sx?$/
));

"bootstrapping stimulus..." is successfully logged to console.

I use yarn as Package Manager. I already flushed the Yarn-Cache and reinstalled all the Packages.

0

There are 0 best solutions below