danvk / source-map-explorer

Analyze and debug space usage through source maps
Apache License 2.0
3.82k stars 100 forks source link

source-map-explorer complains a module with single chunk #122

Closed bugzpodder closed 4 years ago

bugzpodder commented 5 years ago

Currently create-react-app suggests using source-map-explorer as the way to analyze bundles built by it. Since 2.0 it produces a single main bundle contains one chunk. As such the warning below is always showing:

build/static/js/runtime~main.190f72ac.js

  1. Your source map only contains one source (../webpack/bootstrap). This can happen if you use browserify+uglifyjs, for example, and don't set the --in-source-map flag to uglify. See https://github.com/danvk/source-map-explorer/blob/master/README.md#generating-source-maps

I am not sure why this was shown but is there anyway to identify this use and not show it? You can repo by creating a new app and run yarn build: npx create-react-app myapp cd myapp yarn build

nikolay-borzov commented 5 years ago

It's shown because one file source map is "uninteresting". See https://github.com/danvk/source-map-explorer/issues/10. You are not the first who asks to remove this warning. Adding a flag to show/hide this particular message doesn't make sense to me. It's easier to ignore this case and left user unaware. But I want to hear @danvk opinion before removing the warning.

bugzpodder commented 5 years ago

This warning makes 100% sense when the bundle is not split. source-map-explorer only supported single file output up until this year. Now that source-map-explorer supports viewing all js files in the same directory, it may make less sense to show it. We could potentially disable the warning when there are more than one file.

danvk commented 5 years ago

@bugzpodder so you're still getting an interesting visualization despite the warning? In that case I think your suggestion makes sense. Only show the warning if all the source maps have a single source.

bugzpodder commented 5 years ago

Yes, I always get the correct TreeMap to show up with different sources in tact despite the warning. The warning might be more confusing for new users who have no idea what they are expecting.

priley86 commented 4 years ago

Disagree w/ the conclusion here. Single file bundles can be common w/ Create React App builds (many times you will import a single CSS file into your app). The warning is annoying for consumers and suggests it is an error on their part when this is not actually the case. It will just cause more traffic to this issue...thanks for considering this.

priley86 commented 4 years ago

@nikolay-borzov thanks!