Closed elidoran closed 9 years ago
I think this is something that could be easier to figure out with automated tests. I'll maybe write a test later that runs meteor build
and makes sure the source map is stripped.
As of 0.4.0 debug is always set to true to produce the source map. Then, the source map comment is extracted via the exorcist transform and provided to CompileStep separately. This seems to work well.
Exorcist writes the source map to a file. So, we have to read that file to provide it to CompileStep. It'd be nice if we could get it another way, but, in 0.5.0 I'm leaving the file there (instead of deleting it) as a cached map result. So, it's not so bad.
It would be nicer if browserify returned a result object we could get both the file result and its source map from, similar to the coffeescript compiler.
Also be nice if CompileStep provided the file source as a readable stream we could pipe through transforms and back to a CompileStep writable stream instead of holding each file in memory as a string.
Contributors of #7 say:
debug=true
shouldn't cause file bloat in production because Meteor strips out the source map commentThese things make sense to me. However, FlowRouter had an issue with
debug=true
causing the file to be ~10KB larger.When I checked before I did notice the file was larger for production when
debug=true
. I checked recently and the source map Browserify puts in the file is a comment which is removed by Meteor for production. So, what made the file bigger then?As cosmos:browserify is now it sets debug true except when the build or bundle command are run without the
--debug
option. I'm going to maintain that behavior for now. It can be overridden with the new per file configuration feature from #7 by placingdebug:true
in the options file.To determine the proper behavior:
- [ ] verify source map is broken when debug=false- [ ] verify production files are larger when debug=true