Skip to content

Commit

Permalink
Clearer check for differentiating assets from modules
Browse files Browse the repository at this point in the history
  • Loading branch information
bregenspan committed Apr 7, 2019
1 parent 64fdb24 commit 6718ef9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
7 changes: 2 additions & 5 deletions client/components/ModulesTreemap.jsx
Expand Up @@ -246,7 +246,7 @@ export default class ModulesTreemap extends Component {

handleTreemapGroupSecondaryClick = event => {
const {group, x, y} = event;
if (group && this.isAChunk(group)) {
if (group && group.isAsset) {
this.setState({
selectedChunk: group,
selectedMouseCoords: {
Expand Down Expand Up @@ -278,9 +278,6 @@ export default class ModulesTreemap extends Component {

handleFoundModuleClick = module => this.treemap.zoomToGroup(module);

/** Tests whether specified module/group is a top-level group corresponding to a chunk */
isAChunk = group => !!group.parentAssetNames

isModuleVisible = module => (
this.treemap.isGroupRendered(module)
)
Expand All @@ -300,7 +297,7 @@ export default class ModulesTreemap extends Component {
{module.path &&
<div>Path: <strong>{module.path}</strong></div>
}
{this.isAChunk(module) &&
{module.isAsset &&
<div>
<br/>
<strong><em>Right-click to view options related to this chunk</em></strong>
Expand Down
1 change: 1 addition & 0 deletions src/analyzer.js
Expand Up @@ -98,6 +98,7 @@ function getViewerData(bundleStats, bundleDir, opts) {
return _.transform(assets, (result, asset, filename) => {
result.push({
label: filename,
isAsset: true,
// Not using `asset.size` here provided by Webpack because it can be very confusing when `UglifyJsPlugin` is used.
// In this case all module sizes from stats file will represent unminified module sizes, but `asset.size` will
// be the size of minified bundle.
Expand Down

0 comments on commit 6718ef9

Please sign in to comment.