<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Error when using moment.js in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Error-when-using-moment-js/m-p/946958#M22469</link>
    <description>&lt;P&gt;I am trying to use moment.js when creating a custom visual, but get the following error:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Module not found: Error: Can't resolve './locale' in 'F:\XXXXX\.tmp\build'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This appears to be linked to a know issue with moment.js, but none of the workarounds suggested online works. Any hints on how to resolve this when developing a custom visual?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 25 Feb 2020 10:57:52 GMT</pubDate>
    <dc:creator>mrtn</dc:creator>
    <dc:date>2020-02-25T10:57:52Z</dc:date>
    <item>
      <title>Error when using moment.js</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Error-when-using-moment-js/m-p/946958#M22469</link>
      <description>&lt;P&gt;I am trying to use moment.js when creating a custom visual, but get the following error:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Module not found: Error: Can't resolve './locale' in 'F:\XXXXX\.tmp\build'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This appears to be linked to a know issue with moment.js, but none of the workarounds suggested online works. Any hints on how to resolve this when developing a custom visual?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Feb 2020 10:57:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Error-when-using-moment-js/m-p/946958#M22469</guid>
      <dc:creator>mrtn</dc:creator>
      <dc:date>2020-02-25T10:57:52Z</dc:date>
    </item>
    <item>
      <title>Re: Error when using moment.js</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Error-when-using-moment-js/m-p/947712#M22482</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/47124"&gt;@mrtn&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;I've been able to get this to work through the usual means by setting up a new custom visual on SDK v3. My steps as follows:&lt;/P&gt;
&lt;P&gt;Install &lt;FONT face="courier new,courier"&gt;moment.js&lt;/FONT&gt; into your project as a dependency, i.e.:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;npm i moment&lt;/LI-CODE&gt;
&lt;P&gt;Including in my &lt;FONT face="courier new,courier"&gt;visual.ts&lt;/FONT&gt;, e.g.:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;import * as moment from 'moment';&lt;/LI-CODE&gt;
&lt;P&gt;And then doing a quick sanity test in my visual constructor, e.g.:&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;/** Object exists? */
    console.log(moment());
/** Should return 'en' */
    console.log(moment().locale());
/** Display day of week */
    console.log(moment().format('dddd'));
/** Test additional locale for day of week */
    console.log(moment().locale('de').format('dddd'));&lt;/LI-CODE&gt;
&lt;P&gt;And I get this in my browser console (confirming &lt;FONT face="courier new,courier"&gt;moment&lt;/FONT&gt; is accessible):&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 899px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/239421i964C9175D42E7C10/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;If this doesn't work for you we might need to know a bit more about your situation.&amp;nbsp;Are you able to share any code that reproduces the issue for you? If so, it would be useful to get a copy of your &lt;FONT face="courier new,courier"&gt;package.json&lt;/FONT&gt; (for dependencies) and &lt;FONT face="courier new,courier"&gt;pbiviz.json&lt;/FONT&gt; (for API version), just so I can verify if there are some specific issues with the combination of how these are set up in conjunction with your code.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;</description>
      <pubDate>Tue, 25 Feb 2020 21:24:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Error-when-using-moment-js/m-p/947712#M22482</guid>
      <dc:creator>dm-p</dc:creator>
      <dc:date>2020-02-25T21:24:08Z</dc:date>
    </item>
    <item>
      <title>Re: Error when using moment.js</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Error-when-using-moment-js/m-p/951114#M22515</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/397"&gt;@dm-p&lt;/a&gt;&amp;nbsp;Hi Daniel, I followed your suggested steps, moment works just fine when creating a new project.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The issue appears to be related to incompabilities in old packages, as the project is non es2015 and was created on api v1.12. I am fine with sharing anything if you have the time to look into these legacy issues.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have inherited this project and the issues from someone else.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 14:38:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Error-when-using-moment-js/m-p/951114#M22515</guid>
      <dc:creator>mrtn</dc:creator>
      <dc:date>2020-02-27T14:38:44Z</dc:date>
    </item>
    <item>
      <title>Re: Error when using moment.js</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Error-when-using-moment-js/m-p/956723#M22561</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;fixed the issue by migrating the project to the latest API.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Found the description here somewhat helpful, although incomplete.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://microsoft.github.io/PowerBI-visuals/docs/how-to-guide/migrating-to-powerbi-visuals-tools-3-0/" target="_blank"&gt;https://microsoft.github.io/PowerBI-visuals/docs/how-to-guide/migrating-to-powerbi-visuals-tools-3-0/&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Mar 2020 10:01:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Error-when-using-moment-js/m-p/956723#M22561</guid>
      <dc:creator>mrtn</dc:creator>
      <dc:date>2020-03-03T10:01:21Z</dc:date>
    </item>
  </channel>
</rss>

