angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

buildOptimizer changes the behavior of openlayers

Open anthonn opened this issue 8 years ago • 4 comments

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Command (mark with an x)

- [ ] new
- [x] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Versions

node: v11.2.0 npm: 6.4.1 Angular CLI: 7.0.7 Node: 11.2.0 OS: win32 x64 Angular: 7.1.1 ... common, compiler, core, forms, platform-browser ... platform-browser-dynamic, router

Package Version

@angular-devkit/architect 0.10.7 @angular-devkit/build-angular 0.10.7 @angular-devkit/build-optimizer 0.10.7 @angular-devkit/build-webpack 0.10.7 @angular-devkit/core 7.0.7 @angular-devkit/schematics 7.0.7 @angular/cli 7.0.7 @angular/compiler-cli 7.0.4 @angular/language-service 7.0.4 @ngtools/webpack 7.0.7 @schematics/angular 7.0.7 @schematics/update 0.10.7 rxjs 6.3.3 typescript 3.1.6 webpack 4.19.1

Repro steps

please refer to the following issue in the link below. In the bottom of the referenced issue there are test files supplied to be able to reproduce this behavior.

The log given by the failure

No errors are given, only wrong behavior.

Desired functionality

To have openlayers function in the same way with and without buildOptimizer turned on.

Misc

I do not know if this is a openlayers problem or a angular-cli problem. But I did originally post this issue for openlayers. Here is a link and a better description of what is happening: https://github.com/openlayers/openlayers/issues/9019

anthonn avatar Nov 29 '18 22:11 anthonn

@AnthonNilsson I would try to disable "pure_getters" and see if that helps. Check out the following issue thread for more information:

https://github.com/angular/angular-cli/issues/11439

fbernhard avatar Dec 04 '18 10:12 fbernhard

Looks like maybe the tree-shaking was removing some parts of the code related to adding basic projections for the coordinate systems.

By adding the import: import { addCommon as addCommonProjections } from 'ol/proj';

and running the function addCommonProjections();

the testproject started to work.

I'm still not sure though if this problem is an angular one or openlayers. If you do not feel it is related to angular code feel free to close this.

anthonn avatar Dec 06 '18 18:12 anthonn

This is an issue with openlayers' use of the sideEffects option within its package.json. See this issue in its repository: https://github.com/openlayers/openlayers/issues/8815. And also my associated comment here: https://github.com/angular/angular-cli/issues/12760#issuecomment-436612737

clydin avatar Dec 06 '18 18:12 clydin

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.