Styles imported in a chunk not being added to library

Created on 28 April 2024, 7 months ago
Updated 19 August 2024, 3 months ago

Problem/Motivation

While testing this module with a Vite React app, I was finding that styles imported in my JS entry point were not being loaded for production builds.

Steps to reproduce

Given the following manifest:

{
  "src/assets/react.svg": {
    "file": "assets/react-CHdo91hT.svg",
    "src": "src/assets/react.svg"
  },
  "src/main.jsx": {
    "file": "assets/main-Dh-3VRhG.js",
    "name": "main",
    "src": "src/main.jsx",
    "isEntry": true,
    "css": [
      "assets/main-DiwrgTda.css"
    ],
    "assets": [
      "assets/react-CHdo91hT.svg"
    ]
  }
}

$manifest->getStyles($path) will never return results because it uses getChunk to determine the path to the styles. 'assets/main-DiwrgTda.css' is not a chunk in the manifest.

Proposed resolution

Modify getStyles to instead use getPath, allowing css files referenced in a chunk, but not listed as chunks themselves to be loaded.

πŸ› Bug report
Status

Fixed

Version

1.1

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States brianperry

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

Comments & Activities

Production build 0.71.5 2024