Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AssetMapper] Can't extend from a vendor package's stimulus controller #52594

Closed
barbieswimcrew opened this issue Nov 15, 2023 · 3 comments
Closed

Comments

@barbieswimcrew
Copy link

Symfony version(s) affected

6.3.7

Description

When trying to extend a stimulus controller from the vendor package "stimulus-carousel" I get the following error in the browser console:

GET https://localhost.ddev.site/npm/swiper@8.4.7/bundle/+esm net::ERR_ABORTED 404 (Not Found)

I required the package via php bin/console importmap:require stimulus-carousel --download and it got added to the importmap.php file like so:

    'stimulus-carousel' => [
        'downloaded_to' => 'vendor/stimulus-carousel.js',
        'url' => 'https://cdn.jsdelivr.net/npm/stimulus-carousel@5.0.1/+esm',
    ],

Then I created a assets/controllers/carousel_controller.js file with the following content:

import Carousel from 'stimulus-carousel';

/* stimulusFetch: 'lazy' */
export default class CarouselController extends Carousel {
    ...
}

As far as I understand the stimulus-carousel file is internally trying to load the swiper file via import t from"/npm/swiper@8.4.7/bundle/+esm"; but that file doesn't exist right now.

How to handle that? Is there a way to get any further dependencies installed automatically as well? Or do I have to require that file manually? And if so... how?

Thanks for your help in advance!

How to reproduce

Install the stimulus-carouselpackage and create a stimulus controller that extends from the carousel.

Possible Solution

No response

Additional Context

No response

@weaverryan
Copy link
Member

I bet this is fixed in 6.4. To verify - can you remove the downloaded_to? Does it work? If so, then it's just a bug in the download functionality, which was greatly improved in 6.4.

@barbieswimcrew
Copy link
Author

@weaverryan removing the downloaded_to did the trick! thanks ryan for your help! Looking forward to the 6.4 release 🧅

@weaverryan
Copy link
Member

Sweet! Thanks for the follow-up! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants