Issue with component libraries in dev mode

Created on 22 March 2024, 8 months ago
Updated 22 June 2024, 5 months ago

Problem/Motivation

My code works when I use vite build, but not in dev mode.

Steps to reproduce

I have a page with a slideshow that is working fine in both modes.
I have a link that opens an ajax dialog with the slideshow page, using the method: https://www.drupal.org/docs/develop/drupal-apis/ajax-api/ajax-dialog-boxes β†’

When I try to open the dialog, I see the network request for the page, but then nothing happens.

My code is in a component, using javascript attach behaviors and using once. The slider library is defined in my theme.

Can anyone shed some insight on what could be happening? From what I understand, vite is serving the assets that are requested from drupal, according to library dependencies. It looks like the component styles and assets are injected with drupal ajax commands. I can't tell what's different about how it loads in dev mode that would trip it up.

This issue queue seems like the most relevant place on the web for discussing drupal + vite integration. Drupal questions are getting lost in other queues. I'm hoping to collaborate more with people working on this since I think we're blazing the trail.

πŸ’¬ Support request
Status

Closed: outdated

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mortona2k Seattle

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @mortona2k
  • πŸ‡¦πŸ‡ΊAustralia darvanen Sydney, Australia

    @mortona2k did you end up solving this? The issue queue may be slow but at least it doesn't require timezone alignment :)

    If you haven't solved it maybe you could share your libraries.yml snippet and vite config?

  • πŸ‡ΊπŸ‡ΈUnited States mortona2k Seattle

    There were a handful of issues I was running into, mostly not understanding how it all works.

    I can't remember how I fixed this, maybe defining the ajax library dependency another way.

    I'm using Unocss and need to figure out the right order of css so that utilities and component styles play nice together. Making improvements, but still no clear answer.

    I'm ok closing this ticket and spelling out narrower issues if I encounter them again.

  • Status changed to Closed: outdated 5 months ago
  • πŸ‡¦πŸ‡ΊAustralia darvanen Sydney, Australia

    Alright let's close this, feel free to reach out in the #frontend channel of Drupal Slack, I'll keep an eye out :)

Production build 0.71.5 2024