| 178 | : defaultSizeGetter; |
| 179 | |
| 180 | const getModuleLengths = async ({ |
| 181 | id, |
| 182 | code, |
| 183 | }: { |
| 184 | id: string; |
| 185 | code: string | null; |
| 186 | }): Promise<ModuleLengths & { id: string }> => { |
| 187 | const isCodeEmpty = code == null || code == ""; |
| 188 | |
| 189 | const result = { |
| 190 | id, |
| 191 | gzipLength: isCodeEmpty ? 0 : await gzipSizeGetter(code), |
| 192 | brotliLength: isCodeEmpty ? 0 : await brotliSizeGetter(code), |
| 193 | renderedLength: isCodeEmpty ? 0 : Buffer.byteLength(code, "utf-8"), |
| 194 | }; |
| 195 | return result; |
| 196 | }; |
| 197 | |
| 198 | if (opts.sourcemap && !outputOptions.sourcemap) { |
| 199 | this.warn(WARN_SOURCEMAP_DISABLED); |