During development on my localhost, I am trying to self host the libphonenumber library. I am trying with the following:
<script src="//closure-library.googlecode.com/svn/trunk/closure/goog/base.js"></script>
<script>goog.require('goog.proto2.Message');</script>
<script src="scripts/vendor/pn/phonemetadata.pb.js"></script>
<script src="scripts/vendor/pn/phonenumber.pb.js"></script>
<script src="scripts/vendor/pn/metadata.js"></script>
<script src="scripts/vendor/pn/phonenumberutil.js"></script>
<script src="scripts/vendor/pn/asyoutypeformatter.js"></script>
This is working, but I still have a dependency to an externally hosted component: the closure library. I have tried using closure-lite, which is (apparently, I am new here) a quite complete version of the closure library, available for self-hosting. I have tried doing the following:
<script src="scripts/vendor/closure-lite.js"></script>
<script>goog.require('goog.proto2.Message');</script>
<script src="scripts/vendor/pn/phonemetadata.pb.js"></script>
<script src="scripts/vendor/pn/phonenumber.pb.js"></script>
<script src="scripts/vendor/pn/metadata.js"></script>
<script src="scripts/vendor/pn/phonenumberutil.js"></script>
<script src="scripts/vendor/pn/asyoutypeformatter.js"></script>
But the goog.proto2.Message
is not available. I am getting the following errors:
Uncaught TypeError: Cannot read property 'Message' of undefined
The error comes from the phonemetadata.pb.js
script:
goog.inherits(i18n.phonenumbers.NumberFormat, goog.proto2.Message);
What can I do to completely self-host the libphonenumber
?