<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Safwen FELLI</title>
    <description>The latest articles on DEV Community by Safwen FELLI (@sfelli).</description>
    <link>https://dev.to/sfelli</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F384608%2Fa733e647-56db-4e56-824a-78107dc380d4.png</url>
      <title>DEV Community: Safwen FELLI</title>
      <link>https://dev.to/sfelli</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sfelli"/>
    <language>en</language>
    <item>
      <title>Angular 13+ libraries migration Ivy partial lerna/Nx build parallel problem</title>
      <dc:creator>Safwen FELLI</dc:creator>
      <pubDate>Thu, 26 Jan 2023 16:32:24 +0000</pubDate>
      <link>https://dev.to/sfelli/angular-13-libraries-migration-ivy-partial-lernanx-build-parallel-problem-56ia</link>
      <guid>https://dev.to/sfelli/angular-13-libraries-migration-ivy-partial-lernanx-build-parallel-problem-56ia</guid>
      <description>&lt;p&gt;If you are moving to Angular 13+ and you are stick with building your parallel libraries locally or in the CI within a &lt;strong&gt;monorepo&lt;/strong&gt; using lerna/Nx, you are in the right why to fix that.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; ❌ Another process, with &lt;span class="nb"&gt;id &lt;/span&gt;XXXXX, is currently running ngcc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Steep 1
&lt;/h2&gt;

&lt;p&gt;Check if you got in the &lt;strong&gt;tsconfig.lib.prod&lt;/strong&gt; file the partial compilation mode under &lt;strong&gt;angularComplierOptions&lt;/strong&gt; after running the &lt;strong&gt;ng update&lt;/strong&gt; cmd like so :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"angularCompilerOptions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"compilationMode"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"partial"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;And remove the enableIvy from the config is enabled by default&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Steep 2
&lt;/h2&gt;

&lt;p&gt;In the main workspace package.json file you need to add the postinstall script like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"scripts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"postinstall"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ngcc --properties es2015 browser module main"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or you can also add options :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"postinstall"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ngcc --properties es2015 es5 browser module main --first-only --create-ivy-entry-points"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;If no &lt;strong&gt;properties&lt;/strong&gt; flag is given, ngcc will process all package formats (fesm2015, fesm5, es2015, esm2015, esm5, main, module), which may not be what's desired.&lt;/p&gt;

&lt;p&gt;The flag &lt;strong&gt;first-only&lt;/strong&gt; tells ngcc to process the first property it finds in package.json, otherwise it'll process all entries listed above.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;create-ivy-entry-points&lt;/strong&gt; will tell ngcc to create new properties for the Ivy generated entry, instead of overwriting the previous one.&lt;/p&gt;

&lt;p&gt;And it will be compiling with Angular sources in Ivy partial compilation mode.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;⚠️ Note&lt;/strong&gt;: You need to respect the peerDependencies to install correctly the dependencies if it's not work try this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm i &lt;span class="nt"&gt;--legacy-peer-deps&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Hope this help you in the Angular 13+  migration 🎉&lt;/p&gt;

</description>
      <category>learning</category>
      <category>productivity</category>
      <category>vibecoding</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
