Description
Bug Report or Feature Request
- [ ] bug report (maybe)
- [x] feature request (docs I guess)
Area
- [x] devkit
- [ ] schematics
Versions
@angular-devkit/build-optimizer@0.6.8
Issue
After adding sideEffects: false
to a library doing webgl stuff, I found out some code was removed because the library contains unpure functions (any function doing webgl stuff).
Turns out build-optimizer is also using that flag in his process to prefix functions with /*@__PURE__*/
and that is the cause of code removal.
I have build up a repro with one of the function :
https://repl.it/@GhetGhetolay/buildoptimizerwebgl
I'm not sure if
- this is the expected behavior and we should set
isSideEffectFree
to false - it's a bug and webgl functions shouldn't be prefixed with pure
If it's not a bug this means we're using same flag for different purposes, webpack sideEffects
and build-optimizer isSideEffectFree
options are not about the same kind of side effects (module vs functions).
Anyway I think we're missing a bit of docs, neither the Angular Package Format nor the build-optimizer docs mentionned the use of sideEffects
flag by build-optimizer.