webpack-bundle-analyzer 2.9.2 → 2.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/lib/BundleAnalyzerPlugin.js +27 -10
- package/package.json +32 -32
- package/public/viewer.js +1 -1
- package/public/viewer.js.map +1 -1
- package/src/BundleAnalyzerPlugin.js +18 -10
- package/src/analyzer.js +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const bfj = require('bfj-node4');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const mkdir = require('mkdirp');
|
|
4
4
|
const { bold } = require('chalk');
|
|
@@ -61,19 +61,27 @@ class BundleAnalyzerPlugin {
|
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
generateStatsFile(stats) {
|
|
64
|
+
async generateStatsFile(stats) {
|
|
65
65
|
const statsFilepath = path.resolve(this.compiler.outputPath, this.opts.statsFilename);
|
|
66
|
-
|
|
67
66
|
mkdir.sync(path.dirname(statsFilepath));
|
|
68
67
|
|
|
69
|
-
|
|
70
|
-
statsFilepath,
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
try {
|
|
69
|
+
await bfj.write(statsFilepath, stats, {
|
|
70
|
+
promises: 'ignore',
|
|
71
|
+
buffers: 'ignore',
|
|
72
|
+
maps: 'ignore',
|
|
73
|
+
iterables: 'ignore',
|
|
74
|
+
circular: 'ignore'
|
|
75
|
+
});
|
|
73
76
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
+
this.logger.info(
|
|
78
|
+
`${bold('Webpack Bundle Analyzer')} saved stats file to ${bold(statsFilepath)}`
|
|
79
|
+
);
|
|
80
|
+
} catch (error) {
|
|
81
|
+
this.logger.error(
|
|
82
|
+
`${bold('Webpack Bundle Analyzer')} error saving stats file to ${bold(statsFilepath)}: ${error}`
|
|
83
|
+
);
|
|
84
|
+
}
|
|
77
85
|
}
|
|
78
86
|
|
|
79
87
|
async startAnalyzerServer(stats) {
|
package/src/analyzer.js
CHANGED
|
@@ -141,7 +141,7 @@ function getModulePath(module) {
|
|
|
141
141
|
// Removing first `.`
|
|
142
142
|
.slice(1)
|
|
143
143
|
// Replacing `~` with `node_modules`
|
|
144
|
-
.map(part => (part === '~'
|
|
144
|
+
.map(part => (part === '~' ? 'node_modules' : part));
|
|
145
145
|
|
|
146
146
|
return parsedPath.length ? parsedPath : null;
|
|
147
147
|
}
|