Skip to content

CSS files reported as zero-length #203

Description

@mrginglymus

See https://github.com/mrginglymus/rpv-css/blob/main/dist/stats.json - the file is present, but reported as zero length.

As a workaround currently I'm applying the following patch:

diff --git a/dist/plugin/index.js b/dist/plugin/index.js
index cbac456309032373a79a3209a5f80fa720157afa..18591f0cde08c48eaafcc7df58fab5459fad1d1d 100644
--- a/dist/plugin/index.js
+++ b/dist/plugin/index.js
@@ -93,7 +93,7 @@ const visualizer = (opts = {}) => {
                 else {
                     const modules = await Promise.all(Object.entries(bundle.modules)
                         .filter(([id]) => filter(bundleId, id))
-                        .map(([id, { renderedLength, code }]) => getModuleLengths({ id, renderedLength, code }), false));
+                        .map(([id, { renderedLength, code, originalLength }]) => getModuleLengths({ id, renderedLength: id.endsWith('.css') ? originalLength : renderedLength, code }, id.endsWith('.css')), false));
                     tree = (0, data_1.buildTree)(bundleId, modules, mapper);
                 }
                 if (tree.children.length === 0) {

however, as code is null this doesn't really help with gzip calculations.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugdependenciesPull requests that update a dependency file

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions