@statoscope/webpack-stats-extension-compressed
Advanced tools
Comparing version 5.3.1 to 5.4.0
@@ -35,7 +35,13 @@ "use strict"; | ||
const assetPath = path_1.default.join(cursor.compiler.outputPath, name); | ||
const content = await readFile(assetPath); | ||
if (!content) { | ||
throw new Error(`Can't read ${name} asset`); | ||
let content; | ||
try { | ||
content = await readFile(assetPath); | ||
if (!content) { | ||
throw new Error(); | ||
} | ||
this.compressedExtensionGenerator.handleResource(cursor.hash, name, content, this.compressor); | ||
} | ||
this.compressedExtensionGenerator.handleResource(cursor.hash, name, content, this.compressor); | ||
catch (e) { | ||
console.warn(`Can't read the asset ${name}`); | ||
} | ||
} | ||
@@ -52,4 +58,13 @@ const modulesStack = [...cursor.modules]; | ||
let concatenated = Buffer.from(''); | ||
// webpack 5 | ||
if (typeof modulesCursor.getSourceTypes === 'function') { | ||
if (modulesCursor.constructor.name === 'CssModule' && | ||
// @ts-ignore | ||
(typeof modulesCursor.content === 'string' || | ||
// @ts-ignore | ||
modulesCursor.content instanceof Buffer)) { | ||
this.compressedExtensionGenerator.handleResource(cursor.hash, moduleName, | ||
// @ts-ignore | ||
modulesCursor.content, this.compressor); | ||
} | ||
else if (cursor.chunkGraph) { | ||
// webpack 5 | ||
for (const type of modulesCursor.getSourceTypes()) { | ||
@@ -56,0 +71,0 @@ const runtimeChunk = cursor.chunkGraph |
{ | ||
"name": "@statoscope/webpack-stats-extension-compressed", | ||
"version": "5.3.1", | ||
"version": "5.4.0", | ||
"description": "Webpack adapter for @statoscope/stats-extension-compressed", | ||
@@ -25,9 +25,8 @@ "main": "./dist/index.js", | ||
"dependencies": { | ||
"@statoscope/stats-extension-compressed": "^5.3.1" | ||
"@statoscope/stats-extension-compressed": "^5.4.0" | ||
}, | ||
"devDependencies": { | ||
"@statoscope/stats": "5.3.0", | ||
"@statoscope/stats": "^5.3.0", | ||
"@types/webpack": "^5.28.0" | ||
}, | ||
"gitHead": "a6c4b35ab9ed303afc42c054fe56d678a655cf72" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
12350
128