I have an erro run my project in production
"@angular/cli": "^v1.6.7",
"@angular/compiler-cli": "^5.2.3",
just run : ng build --prod
ERROR in chunk main [initial]
[name].[chunkhash:20].bundle.js
Cannot read property 'range' of null
TypeError: Cannot read property 'range' of null
This appears to be a bug but we will need to look at a reproduction to find and fix the problem. Can you setup a minimal reproduction please?
You can read here why this is needed. A good way to make a minimal reproduction is to create a new app via ng new repro-app and adding the minimum possible code to show the problem. Then you can push this repository to github and link it here.
Reverting @angular/common to 5.2.1 solved it for me.
If that is the case here as well, then the issue is here: https://github.com/angular/angular/issues/21809
Note that this is due to a webpack bug and has been corrected in master and should be in the next webpack release.
Try with
ng build --prod -vc=true
@cpelikan That works, but what does it mean?
The --vc option causes a separate vendor bundle to be created. Note that this has the side effect of disabling an optimization that provides a large reduction in final output size.
Off course but yoi can set to false. Anyway is important to explicit the
flag
Il 08 Feb 2018 21:00, "clydin" notifications@github.com ha scritto:
The --vc option causes a separate vendor bundle to be created. Note that
this has the side effect of disabling an optimization that provides a large
reduction in final output size.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/angular/angular-cli/issues/9537#issuecomment-364230670,
or mute the thread
https://github.com/notifications/unsubscribe-auth/APV2lRsS4kz3_pAovM0lw67w6EhaVqPzks5tS1JWgaJpZM4R8rPH
.
Same error with "@angular/compiler-cli":"5.2.4" and "@angular/cli":"1.6.8"
Enabling the --vc option seems to patch the error.
note: @cpelikan --vc=false still throw Cannot read property 'range' of null
I have the same error.
Same error with "@angular/compiler-cli":"5.2.4" and "@angular/cli":"1.6.8"
I solved with
ng build --prod -vc=true
or just -vc because true is default value for --prod
vc is alias of vendor chunk and means use a separate bundle containing only
vendor libraries. For some reason it doesn't works fine by default in this
version of angular cli
2018-02-12 0:40 GMT+01:00 Candido Sales Gomes notifications@github.com:
I have the same error.
Same error with "@angular/compiler-cli":"5.2.4" and "@angular/cli":"1.6.8"—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/angular/angular-cli/issues/9537#issuecomment-364801388,
or mute the thread
https://github.com/notifications/unsubscribe-auth/APV2lf_h9Z3wqltQbwjdQBBUIk-G7NLUks5tT3pzgaJpZM4R8rPH
.
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._
Most helpful comment
Reverting @angular/common to 5.2.1 solved it for me.