tools: Bundler causes rejoining of original streams instead of modified ones
Description
When the build stream is passed through the bundler, the result contains the original split streams instead of the modified ones (e.g., processed by uglify or other minifiers).
Versions & Environment
- polymer-build: 0.6.0
- node: 7.4.0
- Operating System: macOS Sierra 10.12
Steps to Reproduce
-
Generate project from
generator-polymer-init-custom-build2.0.0. -
Install
gulp-uglify:yarn add -D gulp-uglify -
Edit the project’s
gulpfile.jsto usegulp-uglify, and uncommentgulpfile.js:46, which runsuglify:const uglify = require('gulp-uglify'); ... function build() { ... let sourcesStream = polymerProject.sources() .pipe(gulpif(/\.js$/, uglify())) -
Run
gulp build. -
Observe the output of
build/src/my-view1.htmldoes not contain minified JS. -
Comment out
gulpfile.js:69, which pipes the build through the bundler:buildStream = buildStream.pipe(polymerProject.bundler); -
Run
gulp build. -
Observe the output of
build/src/my-view1.htmlcontains minified JS.
Expected Results
Output files contain modified streams.
For example, minified JS like this:
<script>Polymer({is:"my-view1"});let foo=1;console.log(foo++);</script>
Actual Results
Output files contain original/unmodified streams from HTMLSplitter.
For example:
<script>
Polymer({
is: 'my-view1',
});
let foo = 1;
console.log(foo++);
</script>
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 21 (14 by maintainers)
Optimizing before bundle lets you process your source files and dependencies separately. So if you wanted to use something like babel to compile your sources only, you can.
If you aren’t handling your sources and dependencies separately, optimizing after bundling will probably give you a performance boost.