Alexander Mihailov
Alexander Mihailov

Reputation: 1168

Why globalize-compiler needs different globalize includes (npm vs. NuGet)?

After a lot of trying I got the globalize-compiler running and thus also got a js file with the bundled CLDR data (named cldr_en.js). In order to use it I have to do also the following includes:

<script src="node_modules/globalize/dist/globalize-runtime.js"></script>
<script src="node_modules/globalize/dist/globalize-runtime/message.js"></script>
<script src="node_modules/globalize/dist/globalize-runtime/number.js"></script>
<script src="node_modules/globalize/dist/globalize-runtime/plural.js"></script>
<script src="node_modules/globalize/dist/globalize-runtime/date.js"></script>
<script src="node_modules/globalize/dist/globalize-runtime/currency.js"></script>
<script src="node_modules/globalize/dist/globalize-runtime/relative-time.js"></script>
<script src="node_modules/globalize/dist/globalize-runtime/unit.js"></script>
<script src="cldr_en.js"></script>

These files come as dependencies to the globalize-compiler via npm. The problem is that in my project I am using the NuGet globalize package. And if I try:

<script src="js/globalize.js"></script>
<script src="js/globalize/message.js"></script>
<script src="js/globalize/number.js"></script>
<script src="js/globalize/plural.js"></script>
<script src="js/globalize/date.js"></script>
<script src="js/globalize/currency.js"></script>
<script src="js/globalize/relative-time.js"></script>
<script src="js/globalize/unit.js"></script>
<script src="cldr_en.js"></script>

I got js errors and the globalize does not work at all. Could someone tell what is the difference in the globalize packages (npm and NuGet -> globalize vs. globalize-runtime) and if it is possible to work only with the NuGet package in the production.

I would like to setup a build where I use the globalize-compiler to get the bundled CLDR data and after that I want to delete the whole folder and dependencies of the globalize-compiler and only use the produced bundled CLDR files together with the globalize from the NuGet.

Upvotes: 1

Views: 336

Answers (1)

Alexander Mihailov
Alexander Mihailov

Reputation: 1168

After some trying I've notice that globalize-runtime.js is part of the globalize package, but it does not get installed in VisualStudio through the NuGet wizard. So if one copies it there manually it works exactly as with the npm package (one should copy also the globalize-runtime folder containing files with the same names as in globalize, but they are not the same).


Edited 2018-01-15 The owners of the NuGet jquery-globalize package were notified to include the globalize-runtime files to the package.

Upvotes: 1

Related Questions