Styles imported in a chunk not being added to library

Created on 28 April 2024, about 2 months ago
Updated 31 May 2024, 26 days 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

RTBC

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.69.0 2024