Automatically define vite entrypoints based on paths provided in a drupal asset library

Created on 10 February 2023, almost 2 years ago
Updated 3 July 2024, 5 months ago

Problem/Motivation

Currently, asset entrypoints have to be defined in two places:

  • drupal asset library definition (theme/module .libraries.yml)
  • vite config

It would be nice to get entrypoints in vite config automatically from asset library definition. Wihtout the need to manually configure them on the vite side.

Proposed resolution

Create vite plugin that will parse drupal asset library definition (.libaries.yml) and automatically provide entrypoints based on paths configured in asset library definition.

✨ Feature request
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡΅πŸ‡±Poland wotnak

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

Comments & Activities

  • Issue created by @wotnak
  • πŸ‡ΊπŸ‡ΈUnited States mortona2k Seattle

    I think it's easier to go the other way, and have Drupal use manifest.json to define the assets. Vite adds them to the entry chunk's css property.

    It looks like the code is trying to add these bundled files, but only gets them when vite has a certain setup. I added a related issue with a patch.

  • πŸ‡¦πŸ‡ΊAustralia darvanen Sydney, Australia

    I agree with #2. Suggest this issue be closed as "won't fix"

Production build 0.71.5 2024