<?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>Forem: j1ngzoue</title>
    <description>The latest articles on Forem by j1ngzoue (@activeguild).</description>
    <link>https://forem.com/activeguild</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%2F679057%2F1dfa03f2-f032-45d9-b261-92f694e63719.png</url>
      <title>Forem: j1ngzoue</title>
      <link>https://forem.com/activeguild</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/activeguild"/>
    <language>en</language>
    <item>
      <title>Bridging 8th Wall AR and React Three Fiber: How Pose Data Flows into Three.js</title>
      <dc:creator>j1ngzoue</dc:creator>
      <pubDate>Tue, 17 Mar 2026 04:09:14 +0000</pubDate>
      <link>https://forem.com/activeguild/bridging-8th-wall-ar-and-react-three-fiber-how-pose-data-flows-into-threejs-3c4o</link>
      <guid>https://forem.com/activeguild/bridging-8th-wall-ar-and-react-three-fiber-how-pose-data-flows-into-threejs-3c4o</guid>
      <description>&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;I created a React Three Fiber (R3F) wrapper library for the 8th Wall open-source AR engine, called &lt;code&gt;@j1ngzoue/8thwall-react-three-fiber&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;It lets you add image-tracking AR to a React app with minimal boilerplate:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;EighthwallCanvas&lt;/span&gt; &lt;span class="na"&gt;xrSrc&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"/xr.js"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;EighthwallCamera&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;ImageTracker&lt;/span&gt; &lt;span class="na"&gt;targetImage&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"/targets/marker.json"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;mesh&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;boxGeometry&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;meshStandardMaterial&lt;/span&gt; &lt;span class="na"&gt;color&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"hotpink"&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;mesh&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;ImageTracker&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;EighthwallCanvas&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Point your phone camera at the target image, and the 3D object appears anchored to it.&lt;/p&gt;




&lt;h2&gt;
  
  
  Two Canvases, One Screen
&lt;/h2&gt;

&lt;p&gt;The trickiest part of the architecture is layering XR8's camera feed with R3F's 3D scene. They run on separate canvases stacked on top of each other:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌─────────────────────────────┐
│  R3F Canvas (alpha=true)    │  ← 3D objects, transparent background
├─────────────────────────────┤
│  XR8 Canvas                 │  ← camera feed
└─────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both canvases are &lt;code&gt;position: absolute&lt;/code&gt; and fill the container. R3F renders with &lt;code&gt;alpha: true&lt;/code&gt; so the camera feed shows through.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;relative&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;100%&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;100%&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="cm"&gt;/* XR8 renders camera feed here */&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;canvas&lt;/span&gt; &lt;span class="na"&gt;ref&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;xrCanvasRef&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;fillStyle&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;

  &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="cm"&gt;/* R3F renders 3D scene on top, transparent */&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Canvas&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;fillStyle&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="na"&gt;gl&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;alpha&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;children&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Canvas&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;XR8 is initialized with the back canvas:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;XR8&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;xrCanvasRef&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  How XR8 Pose Data Flows into Three.js
&lt;/h2&gt;

&lt;p&gt;XR8 uses a &lt;strong&gt;camera pipeline module&lt;/strong&gt; system. You register a module with named hooks, and XR8 calls them each frame.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Read pose data from XR8
&lt;/h3&gt;

&lt;p&gt;Every frame, XR8 calls &lt;code&gt;onUpdate&lt;/code&gt; with detection results. We extract the pose for our target image:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;XR8&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addCameraPipelineModule&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;image-tracker-marker&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;onUpdate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;processCpuResult&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;detectedImages&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;processCpuResult&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;reality&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;detectedImages&lt;/span&gt;
    &lt;span class="c1"&gt;// [{ name, position: {x,y,z}, rotation: {x,y,z,w}, scale }]&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;pose&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;detectedImages&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;img&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;img&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;marker&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nx"&gt;latestPoseRef&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;pose&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We store the latest pose in a ref — not state — because we don't want a re-render every frame.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Apply pose to a Three.js group in useFrame
&lt;/h3&gt;

&lt;p&gt;R3F's &lt;code&gt;useFrame&lt;/code&gt; runs once per render frame. We read the latest pose and apply it directly to the &lt;code&gt;&amp;lt;group&amp;gt;&lt;/code&gt; that wraps the AR content:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nf"&gt;useFrame&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;pose&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;latestPoseRef&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;pose&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;groupRef&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt;

  &lt;span class="nx"&gt;groupRef&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;position&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nx"&gt;pose&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;position&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;pose&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;position&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;pose&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;position&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="nx"&gt;groupRef&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;quaternion&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nx"&gt;pose&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;rotation&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;pose&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;rotation&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;pose&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;rotation&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;pose&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;rotation&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;w&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="nx"&gt;groupRef&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;scale&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setScalar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;pose&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;scale&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 3: Show/hide on detection events
&lt;/h3&gt;

&lt;p&gt;XR8 fires events when a target is found or lost. We use these to toggle visibility:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;listeners&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;event&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;reality.imagefound&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;process&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;detail&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;detail&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="nx"&gt;targetName&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt;
      &lt;span class="nf"&gt;setVisible&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;event&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;reality.imagelost&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;process&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;detail&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;detail&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="nx"&gt;targetName&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt;
      &lt;span class="nf"&gt;setVisible&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="nx"&gt;latestPoseRef&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;],&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The final JSX renders a &lt;code&gt;&amp;lt;group&amp;gt;&lt;/code&gt; whose visibility and transform are driven entirely by XR8:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;group&lt;/span&gt; &lt;span class="na"&gt;ref&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;groupRef&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="na"&gt;visible&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;visible&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;children&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;group&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Syncing the Camera Matrix
&lt;/h2&gt;

&lt;p&gt;The 3D scene also needs to match the physical camera's field of view. XR8 provides &lt;code&gt;videoWidth&lt;/code&gt; and &lt;code&gt;videoHeight&lt;/code&gt; from the device camera, which we use to estimate the FOV and update the Three.js camera matrix each frame:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;XR8&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addCameraPipelineModule&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;camera-sync&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;onStart&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;videoWidth&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;videoHeight&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Estimate FOV from video aspect ratio&lt;/span&gt;
    &lt;span class="nx"&gt;activeFov&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;estimateFovFromVideo&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;videoWidth&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;videoHeight&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;onUpdate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;processCpuResult&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;cameraProjectionMatrix&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
      &lt;span class="nx"&gt;processCpuResult&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;reality&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;cameraProjectionMatrix&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;cameraProjectionMatrix&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="c1"&gt;// Store for use in useFrame&lt;/span&gt;
      &lt;span class="nx"&gt;latestMatrixRef&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;cameraProjectionMatrix&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;

&lt;span class="nf"&gt;useFrame&lt;/span&gt;&lt;span class="p"&gt;(({&lt;/span&gt; &lt;span class="nx"&gt;camera&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;latestMatrixRef&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;camera&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;projectionMatrix&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fromArray&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;latestMatrixRef&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nx"&gt;camera&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;projectionMatrixInverse&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;copy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;camera&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;projectionMatrix&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;invert&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="nx"&gt;camera&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;matrixAutoUpdate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Without this, 3D objects would appear at the wrong depth and scale relative to the real world.&lt;/p&gt;




&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;strong&gt;two stacked canvases&lt;/strong&gt; to combine XR8's camera feed with R3F's transparent 3D scene&lt;/li&gt;
&lt;li&gt;XR8 pose data flows through a &lt;strong&gt;camera pipeline module&lt;/strong&gt; → &lt;code&gt;ref&lt;/code&gt; → &lt;code&gt;useFrame&lt;/code&gt; → Three.js group transform&lt;/li&gt;
&lt;li&gt;Store pose in a &lt;strong&gt;ref, not state&lt;/strong&gt;, to avoid unnecessary re-renders every frame&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  - Sync the &lt;strong&gt;Three.js camera projection matrix&lt;/strong&gt; with XR8's data so depth and scale match the real world
&lt;/h2&gt;

&lt;p&gt;The library is on npm:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; @j1ngzoue/8thwall-react-three-fiber
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;GitHub: &lt;a href="https://github.com/activeguild/8thwall-react-three-fiber" rel="noopener noreferrer"&gt;https://github.com/activeguild/8thwall-react-three-fiber&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webxr</category>
      <category>react</category>
      <category>threejs</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Notes on using the Sass Package Importer with Vite</title>
      <dc:creator>j1ngzoue</dc:creator>
      <pubDate>Sun, 22 Sep 2024 13:15:41 +0000</pubDate>
      <link>https://forem.com/activeguild/notes-on-using-the-sass-package-importer-with-vite-2a8d</link>
      <guid>https://forem.com/activeguild/notes-on-using-the-sass-package-importer-with-vite-2a8d</guid>
      <description>&lt;p&gt;With the introduction of &lt;code&gt;Sass&lt;/code&gt;'s &lt;code&gt;Package Importer feature&lt;/code&gt;, loading &lt;code&gt;Sass&lt;/code&gt; files has become simpler and more flexible. This article explains how to use &lt;code&gt;Vite&lt;/code&gt; in combination with &lt;code&gt;Sass&lt;/code&gt;'s &lt;code&gt;Package Importer&lt;/code&gt; and how to deal with errors you may encounter when doing so.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Sass's Package Importer?
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;Package Importer feature&lt;/code&gt; in &lt;code&gt;Sass&lt;/code&gt;, released in 2024, is a revolutionary feature that allows you to import &lt;code&gt;Node.js&lt;/code&gt; packages directly. It is more convenient than the traditional &lt;a class="mentioned-user" href="https://dev.to/import"&gt;@import&lt;/a&gt; statement and is suitable for modern Sass projects. This feature simplifies project dependency management and eliminates the need to manually specify the &lt;code&gt;Sass&lt;/code&gt; file for a package.&lt;/p&gt;

&lt;p&gt;More details are explained in an announcement on the official &lt;code&gt;Sass&lt;/code&gt; blog. It seems that most CSS frameworks can use it without any changes at the publisher.&lt;br&gt;
&lt;a href="https://sass-lang.com/blog/announcing-pkg-importers/" rel="noopener noreferrer"&gt;https://sass-lang.com/blog/announcing-pkg-importers/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Also, in line with Package Importer support,&lt;/p&gt;
&lt;h2&gt;
  
  
  Vite and Sass Integration
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;Vite&lt;/code&gt; is a module bundler popular for its speed and ease of use. It is particularly well suited for front-end development and integrates smoothly with &lt;code&gt;Sass&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Starting with &lt;code&gt;Vite:5.4.0&lt;/code&gt;, support for the &lt;code&gt;Sass&lt;/code&gt; moder api has been added. If you want to use it, you need to upgrade to version 5.4.0 or higher.&lt;br&gt;
&lt;a href="https://github.com/vitejs/vite/blob/v5.4.6/packages/vite/CHANGELOG.md#540-beta0-2024-07-30" rel="noopener noreferrer"&gt;https://github.com/vitejs/vite/blob/v5.4.6/packages/vite/CHANGELOG.md#540-beta0-2024-07-30&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You also need to set &lt;code&gt;importers&lt;/code&gt; in &lt;code&gt;vite.config.ts&lt;/code&gt; as follows&lt;br&gt;
&lt;a href="https://sass-lang.com/documentation/js-api/classes/nodepackageimporter/" rel="noopener noreferrer"&gt;https://sass-lang.com/documentation/js-api/classes/nodepackageimporter/&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;defineConfig&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="err"&gt;“&lt;/span&gt;&lt;span class="nx"&gt;vite&lt;/span&gt;&lt;span class="err"&gt;”&lt;/span&gt;&lt;span class="p"&gt;;.&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;NodePackageImporter&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="err"&gt;“&lt;/span&gt;&lt;span class="nx"&gt;sass&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;embedded&lt;/span&gt;&lt;span class="err"&gt;”&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nf"&gt;defineConfig&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;css&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;preprocessorOptions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;scss&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;api&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="err"&gt;“&lt;/span&gt;&lt;span class="nx"&gt;modern&lt;/span&gt;&lt;span class="err"&gt;”&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;scss&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;preprocessorOptions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;scss&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;preprocessorOptions&lt;/span&gt;
        &lt;span class="na"&gt;importers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;NodePackageImporter&lt;/span&gt;&lt;span class="p"&gt;()],&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Internally at build time, the &lt;a href="https://sass-lang.com/%20documentation/js-api/classes/asynccompiler/" rel="noopener noreferrer"&gt;compile function&lt;/a&gt; is now called.&lt;/p&gt;

&lt;h2&gt;
  
  
  Build errors that occur with Vite and their causes
&lt;/h2&gt;

&lt;p&gt;When using the &lt;code&gt;Package Importer&lt;/code&gt; with &lt;code&gt;Vite&lt;/code&gt; using the &lt;code&gt;sass&lt;/code&gt; package, I encountered the following error at build time.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[vite:css] [sass] Error: TypeError: importer.findFileUrl is not a function
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is due to a conflict when trying to use the &lt;code&gt;Vite&lt;/code&gt; dependency &lt;code&gt;sass-embedded&lt;/code&gt; and the traditional &lt;code&gt;Sass&lt;/code&gt; package, as they are recognized as different instances of &lt;code&gt;NodePackageImporter&lt;/code&gt;. This error is due to the fact that the instances used inside &lt;code&gt;Sass&lt;/code&gt; and &lt;code&gt;Vite&lt;/code&gt; do not match.&lt;br&gt;
It is hard to tell from the error, but the error is actually in the following section&lt;br&gt;
&lt;a href="https://github.com/sass/embedded-host-node/blob/59dde59163a58a33aa8180dbf8e23d2216913712/lib/src/importer-registry.ts#L84-L109" rel="noopener noreferrer"&gt;https://github.com/sass/embedded-host-node/blob/59dde59163a58a33aa8180dbf8e23d2216913712/lib/src/importer-registry.ts#L84-L109&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Solution to the error
&lt;/h2&gt;

&lt;p&gt;To work around this error, you need to change your &lt;code&gt;Vite&lt;/code&gt; settings appropriately. Specifically, it is best to proceed with development assuming that Vite does not import Sass packages separately, but uses &lt;code&gt;sass-embedded&lt;/code&gt; provided by &lt;code&gt;Vite&lt;/code&gt;. &lt;a href="https://ja.vitejs.dev/config/shared-options.html#css-preprocessoroptions" rel="noopener noreferrer"&gt;official&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This issue is also raised in &lt;a href="https://github.com/vitejs/vite/issues/16438#issuecomment-2311325156" rel="noopener noreferrer"&gt;GitHub Issue #16438&lt;/a&gt;. Instead of using the traditional &lt;code&gt;Sass&lt;/code&gt; package, you should set &lt;code&gt;css.preprocessorOptions&lt;/code&gt; to assume sass-embedded. Note that it is &lt;code&gt;or sass&lt;/code&gt; but it doesn't work.&lt;/p&gt;
&lt;h2&gt;
  
  
  I thought I didn't get an error not too long ago?
&lt;/h2&gt;

&lt;p&gt;I checked and &lt;code&gt;sass-embedded&lt;/code&gt; was included in &lt;code&gt;peerDependencies&lt;/code&gt; at this time, so it must have been an error since then.&lt;br&gt;
&lt;a href="https://github.com/vitejs/vite/commit/1025bb6d8f21c0cb9fe72405d42e0f91bb3f1d8e" rel="noopener noreferrer"&gt;https://github.com/vitejs/vite/commit/1025bb6d8f21c0cb9fe72405d42e0f91bb3f1d8e&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Also, it seems that &lt;code&gt;sass-embedded&lt;/code&gt; is preferred, so you need to use &lt;code&gt;sass-embedded&lt;/code&gt; when using &lt;code&gt;modern&lt;/code&gt; in any case.&lt;br&gt;
&lt;a href="https://github.com/vitejs/vite/blob/f9691767ad763720065cc7c5c7f369f97b4e7ea8/packages/vite/src/node/plugins/css.ts#L2030-L2046" rel="noopener noreferrer"&gt;https://github.com/vitejs/vite/blob/f9691767ad763720065cc7c5c7f369f97b4e7ea8/packages/vite/src/node/plugins/css.ts#L2030-L2046&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Since I was using &lt;code&gt;npm&lt;/code&gt; at the time of verification, I think the result would have been different if I had resolved &lt;code&gt;peerDependencies&lt;/code&gt; and used &lt;code&gt;pnpm&lt;/code&gt; for the installation.&lt;br&gt;
Later, I also confirmed that if I actually used &lt;code&gt;pnpm&lt;/code&gt; and installed only &lt;code&gt;sass&lt;/code&gt;, the build finished successfully with the following code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { defineConfig } from “vite”;.
import { NodePackageImporter } from “sass”;

export default defineConfig({
  css: {
    preprocessorOptions: {
      scss: {
        api: “modern”, { importers:[new NodePackageImporter } from “sass”; export default
        importers: [new NodePackageImporter()], }
      }, }
    }, }
  }, }
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Efficient CSS loading
&lt;/h2&gt;

&lt;p&gt;This should go without saying, but when using the &lt;code&gt;Sass&lt;/code&gt; package importer, if you load the entire package like &lt;code&gt;@use “pkg:bulma”;&lt;/code&gt; all CSS will be included in the build. This may result in a large CSS file after the build, as many unnecessary styles are included.&lt;/p&gt;

&lt;p&gt;In such cases, it is recommended to specify and load only the necessary components. For example, if you want to use only some components of &lt;code&gt;Bulma&lt;/code&gt;, specify as follows&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@use “pkg:bulma/sass/components/breadcrumb”;.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This way, only the necessary CSS is included in the build, thus compressing the post-build stylesheet and optimizing file size. Even so, unnecessary css will probably be included. In that case, you may need to write your own purge process.&lt;/p&gt;

&lt;p&gt;If you want to use only common &lt;code&gt;functions&lt;/code&gt; or &lt;code&gt;utilities&lt;/code&gt;, it is better to set them to &lt;code&gt;additionalData&lt;/code&gt; and load them as before.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { defineConfig } from “vite”;.
import react from “@vitejs/plugin-react”;
import { NodePackageImporter } from “sass-embedded”;

export default defineConfig({
  css: {
    preprocessorOptions: {
      scss: {
        api: “modern”, importers: [new NodePackageImporter()], {
        importers: [new NodePackageImporter()], { additionalData: `@use “pkg:bulma/sass/utilities” as
        additionalData: `@use “pkg:bulma/sass/utilities” as utilities;;`,
      }, }
    }, }
  }, }
  plugins: [react()], `@use “pkg:bulma/sass/utilities” as utilities;;`, }, }
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Build USD and bring USD up to date in usdz tool</title>
      <dc:creator>j1ngzoue</dc:creator>
      <pubDate>Fri, 01 Mar 2024 10:25:02 +0000</pubDate>
      <link>https://forem.com/activeguild/build-usd-and-bring-usd-up-to-date-in-usdz-tool-4453</link>
      <guid>https://forem.com/activeguild/build-usd-and-bring-usd-up-to-date-in-usdz-tool-4453</guid>
      <description>&lt;p&gt;We use the latest versions of OpenUSD and usdPython as of 2024/03/01.&lt;/p&gt;

&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Apple's usdPython python version is stuck at 3.7.9, so build and use USD with the latest python version available for OpenUSD.

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://developer.apple.com/jp/augmented-reality/tools/" rel="noopener noreferrer"&gt;USDZ tool&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/PixarAnimationStudios/OpenUSD" rel="noopener noreferrer"&gt;OpenUSD&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;Available Python versions can be found &lt;a href="https://github.com/PixarAnimationStudios/OpenUSD/blob/release/VERSIONS.md" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The version as of 2024/03/01 was 3.9.13.&lt;/p&gt;

&lt;h1&gt;
  
  
  Step 1 Preparation before build
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Since we are using 3.7.9 python, install the latest version with pyenv&lt;/li&gt;
&lt;li&gt;The latest was &lt;a href="https://www.python.org/downloads/" rel="noopener noreferrer"&gt;3.12.2&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pyenv install 3.12.2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pyenv local 3.12.2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In &lt;code&gt;python&lt;/code&gt;, we also want to be able to run &lt;code&gt;python3&lt;/code&gt;, so run the following&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;alias python="python3"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;In USD, the &lt;code&gt;usdView&lt;/code&gt; command uses &lt;code&gt;pyside6&lt;/code&gt;, so install it.&lt;/li&gt;
&lt;li&gt;You can also use &lt;code&gt;pyside2&lt;/code&gt;.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python -m pip install pyside6
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Step 2 Build
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Peel off unnecessary things with option
(be patient as it takes time to build)
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python USD/build_scripts/build_usd.py /path/to/my_usd_install_dir --no-examples --no-tests --no-docs --no-ptex --no-openvdb --no-draco --no --materialx --no-examples
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Dealing with build errors
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Install &lt;code&gt;pyOpenGL&lt;/code&gt; to deal with the error.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PyOpenGL is not installed; if pip is installed, run "pip install PyOpenGL" to install it, then re-run this script.
If PyOpenGL is already installed, you may need to update your PYTHONPATH to indicate where PyOpenGL is located.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install PyOpenGL
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 3 Replace
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The U.S. dollar/ distribution is replaced.
After replacing, see &lt;a href="https://github.com/activeguild/USDPython/tree/main/USD" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 4 Run usdzconvert
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;usdzconvert . /cube.glb ~/cube.usdz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I get an error.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Input file: /Users/xxxxxx/Documents/cube.glb
Traceback (most recent call last):
  File "/Users/xxxxxx/projects/USDPython/./usdzconvert/usdzconvert", line 860, in &amp;lt;module&amp;gt;
    errorValue = main()
  File "/Users/xxxxxx/projects/USDPython/./usdzconvert/usdzconvert", line 855, in main
    return tryProcess(sys.argv[1:])
  File "/Users/xxxxxx/projects/USDPython/./usdzconvert/usdzconvert", line 810, in tryProcess
    ret = process(argumentList)
  File "/Users/xxxxxx/projects/USDPython/./usdzconvert/usdzconvert", line 650, in process
    usdStage = usdStageWithGlTF_module.usdStageWithGlTF(srcPath, tmpPath, legacyModifier, openParameters)
  File "/Users/xxxxxx/projects/USDPython/usdzconvert/usdStageWithGlTF.py", line 1529, in usdStageWithGlTF
    return converter.makeUsdStage()
  File "/Users/xxxxxx/projects/USDPython/usdzconvert/usdStageWithGlTF.py", line 1512, in makeUsdStage
    self.processNodeChildren(self.gltf['scenes'][0]['nodes'], self.asset.getGeomPath(), None)
  File "/Users/xxxxxx/projects/USDPython/usdzconvert/usdStageWithGlTF.py", line 1399, in processNodeChildren
    self.processNode(nodeIdx, path, underSkeleton, indent)
  File "/Users/xxxxxx/projects/USDPython/usdzconvert/usdStageWithGlTF.py", line 1366, in processNode
    usdGeom = self.processMesh(nodeIdx, newPath, underSkeleton)
  File "/Users/xxxxxx/projects/USDPython/usdzconvert/usdStageWithGlTF.py", line 1316, in processMesh
    usdGeom = self.processPrimitive(nodeIdx, gltfPrimitives[0], path, skinIdx, underSkeleton)
  File "/Users/xxxxxx/projects/USDPython/usdzconvert/usdStageWithGlTF.py", line 1142, in processPrimitive
    normalPrimvar = usdGeom.CreatePrimvar('normals', Sdf.ValueTypeNames.Normal3fArray, UsdGeom.Tokens.vertex)
AttributeError: 'Mesh' object has no attribute 'CreatePrimvar'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check the issue and fix &lt;code&gt;usdzconvert/usdStageWithGlTF.py&lt;/code&gt;.&lt;br&gt;
&lt;a href="https://github.com/PixarAnimationStudios/OpenUSD/issues/2628" rel="noopener noreferrer"&gt;https://github.com/PixarAnimationStudios/OpenUSD/issues/2628&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/activeguild/USDPython/commit/482afe50eba109c7d68b082edef003af4ec2e279" rel="noopener noreferrer"&gt;https://github.com/activeguild/USDPython/commit/482afe50eba109c7d68b082edef003af4ec2e279&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Confirmation that &lt;code&gt;usdzconverter&lt;/code&gt; terminates normally with the above modification.&lt;/p&gt;

</description>
      <category>usd</category>
      <category>usdpython</category>
      <category>usdzconverter</category>
      <category>opneusd</category>
    </item>
    <item>
      <title>Animated texture library for react-three-fiber available in react's hooks base</title>
      <dc:creator>j1ngzoue</dc:creator>
      <pubDate>Thu, 14 Dec 2023 07:21:04 +0000</pubDate>
      <link>https://forem.com/activeguild/animated-texture-library-for-react-three-fiber-available-in-reacts-hooks-base-29ff</link>
      <guid>https://forem.com/activeguild/animated-texture-library-for-react-three-fiber-available-in-reacts-hooks-base-29ff</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;We have created a simple library that will load animation textures by specifying an image file (gif/png/apng) file.&lt;br&gt;
&lt;a href="https://github.com/activeguild/animation-texture" rel="noopener noreferrer"&gt;Repository&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Frames are parsed using &lt;a href="https://github.com/matt-way/gifuct-js" rel="noopener noreferrer"&gt;gifuct-js&lt;/a&gt; and &lt;a href="https://github.com/photopea/UPNG.js" rel="noopener noreferrer"&gt;UPNG.js&lt;/a&gt;. The frame parsing process has a large impact on the main thread, so it is executed on the web worker.&lt;/p&gt;

&lt;p&gt;It can be used without preparing a sprited image.&lt;/p&gt;

&lt;h2&gt;
  
  
  Install
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm i animation-texture
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Usage
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useRef&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;useEffect&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;THREE&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;three&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useAnimationTexture&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;animation-texture&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;Props&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Model&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;url&lt;/span&gt; &lt;span class="p"&gt;}:&lt;/span&gt; &lt;span class="nx"&gt;Props&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;animationTexture&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useAnimationTexture&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;url&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;meshRef&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useRef&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

  &lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;meshRef&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;animationTexture&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;meshRef&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;material&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;animationTexture&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nx"&gt;meshRef&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;material&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;needsUpdate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;animationTexture&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;

  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;mesh&lt;/span&gt; &lt;span class="nx"&gt;ref&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;meshRef&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;position&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;THREE&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Vector3&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;planeGeometry&lt;/span&gt; &lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]}&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;meshBasicMaterial&lt;/span&gt; &lt;span class="nx"&gt;transparent&lt;/span&gt; &lt;span class="nx"&gt;side&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;THREE&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;FrontSide&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/mesh&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Pre-load if necessary.
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;THREE&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;three&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;preLoad&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;animation-texture&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;App&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;preLoad&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/sample.png&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsu3pkvv391wzsbj8791m.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsu3pkvv391wzsbj8791m.gif" alt=" " width="680" height="735"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I believe there is still significant room for performance improvement.&lt;/p&gt;

</description>
      <category>react</category>
      <category>three</category>
      <category>png</category>
      <category>gif</category>
    </item>
    <item>
      <title>Type-safe use of css custom-property in Vite</title>
      <dc:creator>j1ngzoue</dc:creator>
      <pubDate>Fri, 30 Dec 2022 12:45:27 +0000</pubDate>
      <link>https://forem.com/activeguild/type-safe-use-of-css-custom-property-in-vite-g3d</link>
      <guid>https://forem.com/activeguild/type-safe-use-of-css-custom-property-in-vite-g3d</guid>
      <description>&lt;h2&gt;
  
  
  Introduce
&lt;/h2&gt;

&lt;p&gt;When staring with css modules in react, I often encounter situations where custom properties are used.&lt;br&gt;
When staring with css modules in react, I often encounter situations where custom properties are used.&lt;br&gt;
We have released a tool that solves those problems, and we would like to introduce it to you.&lt;br&gt;
If you are using &lt;a href="https://ja.vitejs.dev/" rel="noopener noreferrer"&gt;Vite&lt;/a&gt;, you can read and use &lt;a href="https://ja.vitejs.dev/config/shared-options.html#css-preprocessoroptions" rel="noopener noreferrer"&gt;css-preprocessoroptions&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  Repo
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/activeguild/css-custom-property-extractor" rel="noopener noreferrer"&gt;https://github.com/activeguild/css-custom-property-extractor&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Usage
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Install the package.
&lt;/li&gt;
&lt;/ul&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;-D&lt;/span&gt; css-custom-property-extractor
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;For example. Parsing &lt;a href="https://github.com/activeguild/css-custom-property-extractor/blob/main/samples/scss/bootstrap.scss" rel="noopener noreferrer"&gt;bootstrap.scss&lt;/a&gt; outputs the following typescript file.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx ccpe -i ./samples/scss/bootstrap.scss
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;output.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/**
 *  #0d6efd;
 */
export const bsBlue = "var(--bs-blue)"
/**
 *  #6610f2;
 */
export const bsIndigo = "var(--bs-indigo)"
/**
 *  #6f42c1;
 */
export const bsPurple = "var(--bs-purple)"
...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Import and use the output typescript file.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  At the end
&lt;/h2&gt;

&lt;p&gt;We have shown how to bring custom properties into the TS world and use them in type safety.&lt;br&gt;
In addition to this, please read on to find out how to load styles and use classes in a type-safe manner.&lt;br&gt;
&lt;a href="https://dev.to/activeguild/i-made-a-typescript-plugin-for-css-modules-that-can-be-used-with-vite-3ofg"&gt;https://dev.to/activeguild/i-made-a-typescript-plugin-for-css-modules-that-can-be-used-with-vite-3ofg&lt;/a&gt;&lt;br&gt;
&lt;a href="https://dev.to/activeguild/type-safe-development-with-vite-x-react-x-css-modules-x-typescript-1ebc"&gt;https://dev.to/activeguild/type-safe-development-with-vite-x-react-x-css-modules-x-typescript-1ebc&lt;/a&gt;&lt;/p&gt;

</description>
      <category>css</category>
      <category>typescript</category>
      <category>custom</category>
      <category>property</category>
    </item>
    <item>
      <title>I made a plugin to remember todo comments on the code in vite</title>
      <dc:creator>j1ngzoue</dc:creator>
      <pubDate>Wed, 01 Jun 2022 02:27:29 +0000</pubDate>
      <link>https://forem.com/activeguild/remember-todo-left-on-the-code-57p0</link>
      <guid>https://forem.com/activeguild/remember-todo-left-on-the-code-57p0</guid>
      <description>&lt;h2&gt;
  
  
  Introduce
&lt;/h2&gt;

&lt;p&gt;Often we forget the todo left on the code.&lt;br&gt;
IDE extensions and other features are added, but because of differences in development environments among members and the fact that they are not always visible, they are often noticed just before the release of a product.&lt;/p&gt;

&lt;p&gt;We believe that incorporating it as part of the build may prevent it.&lt;br&gt;
Recently, we have been using &lt;code&gt;vite&lt;/code&gt; a lot, so we created a plugin that can be used with &lt;code&gt;vite&lt;/code&gt;.&lt;br&gt;
&lt;a href="https://github.com/activeguild/vite-plugin-hit-word" rel="noopener noreferrer"&gt;see plugin.&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Usage
&lt;/h2&gt;
&lt;h4&gt;
  
  
  Install
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i -D vite-plugin-hit-word
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h4&gt;
  
  
  Add it to vite.config.ts
&lt;/h4&gt;

&lt;p&gt;A deadline can be set on the code by assigning a date. If the deadline is exceeded, it will be output in red on the terminal.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;defineConfig&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;vite&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;hitWord&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;vite-plugin-hit-word&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="c1"&gt;// https://vitejs.dev/config/&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nf"&gt;defineConfig&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="nf"&gt;hitWord&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
      &lt;span class="na"&gt;include&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;src/*&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
      &lt;span class="na"&gt;exclude&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;node_modules&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
      &lt;span class="na"&gt;word&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;[todo]:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;hasDeadlineDate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;}),&lt;/span&gt;
  &lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  e.g.
&lt;/h4&gt;

&lt;p&gt;The following files are available.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;styles&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./App.module.css&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;App&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// [todo]: [2022/05/22] issue #765&lt;/span&gt;

  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"App"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;header&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;styles&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;header&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;header&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At build time, output to the terminal as follows.&lt;br&gt;
You can jump to the corresponding code from the path.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;/Users/XXXXXX/projects/Sample/src/App.tsx&lt;span class="o"&gt;(&lt;/span&gt;4&lt;span class="o"&gt;)&lt;/span&gt; :&amp;gt;&amp;gt;   // &lt;span class="o"&gt;[&lt;/span&gt;todo]: &lt;span class="o"&gt;[&lt;/span&gt;2022/05/22] issue &lt;span class="c"&gt;#765&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I have shown an example with &lt;code&gt;todo&lt;/code&gt;, but it can be changed to suit your project.&lt;/p&gt;

&lt;p&gt;Feedback is welcome. &lt;/p&gt;

</description>
      <category>vite</category>
      <category>todo</category>
      <category>plugin</category>
      <category>word</category>
    </item>
    <item>
      <title>Migration CSS modules to vanilla-extract</title>
      <dc:creator>j1ngzoue</dc:creator>
      <pubDate>Fri, 13 May 2022 04:48:34 +0000</pubDate>
      <link>https://forem.com/activeguild/ive-published-a-tool-to-generate-css-to-vanilla-extract-3n3g</link>
      <guid>https://forem.com/activeguild/ive-published-a-tool-to-generate-css-to-vanilla-extract-3n3g</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;We have created a tool to generate typescript files for vanilla-extract, a Zero-runtime Stylesheets, from css (scss/sass) style definitions.&lt;br&gt;
&lt;a href="https://github.com/activeguild/css-to-vanilla-extract" rel="noopener noreferrer"&gt;https://github.com/activeguild/css-to-vanilla-extract&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The tools described here can be tried in the &lt;a href="https://css-to-vanilla-extract.netlify.app/" rel="noopener noreferrer"&gt;playground&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The following APIs are covered.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://vanilla-extract.style/documentation/styling-api/#style" rel="noopener noreferrer"&gt;styling-api/#style&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vanilla-extract.style/documentation/styling-api/#globalstyle" rel="noopener noreferrer"&gt;styling-api/#globalstyle&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vanilla-extract.style/documentation/styling-api/#globalfontface" rel="noopener noreferrer"&gt;styling-api/#globalfontface&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vanilla-extract.style/documentation/styling-api/#globalkeyframes" rel="noopener noreferrer"&gt;styling-api/#globalkeyframes&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Motivation
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Convert style definitions received from designers without any errors.&lt;/li&gt;
&lt;li&gt;Cost-effective migration of existing projects using css modules.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  e.g.
&lt;/h2&gt;

&lt;h3&gt;
  
  
  input
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.foo {
  background-color: blue;
}
@media (min-width: 1200px) {
  .foo {
    font-size: 5rem;
    color: red;
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  output
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { style } from "@vanilla-extract/css";
export const foo = style({
  backgroundColor: "blue",
  "@media": {
    "(min-width: 1200px)": {
      color: "red",
      fontSize: "5rem",
    },
  },
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This tool was created on a trial basis.I think css modules and other css can be converted with little or no problem.&lt;/p&gt;

</description>
      <category>vanillaextract</category>
      <category>css</category>
      <category>cssmodules</category>
      <category>migration</category>
    </item>
    <item>
      <title>It looks like using picocolors is better than chalk.</title>
      <dc:creator>j1ngzoue</dc:creator>
      <pubDate>Mon, 24 Jan 2022 03:10:55 +0000</pubDate>
      <link>https://forem.com/activeguild/it-looks-like-using-picocolors-is-better-than-chalk-jmj</link>
      <guid>https://forem.com/activeguild/it-looks-like-using-picocolors-is-better-than-chalk-jmj</guid>
      <description>&lt;p&gt;I think it is common to use the &lt;a href="https://github.com/chalk/chalk" rel="noopener noreferrer"&gt;chalk&lt;/a&gt; library to add color to the text output to the console.It is also large and dependent on other libraries.By using a library called &lt;a href="https://github.com/alexeyraspopov/picocolors" rel="noopener noreferrer"&gt;picocolors&lt;/a&gt;, we can expect to improve the size and speed of the package.The usability is almost the same, so it will be available as usual.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Taken from the library READEME&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmlebz52h0iu0k67oslw5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmlebz52h0iu0k67oslw5.png" width="761" height="914"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

</description>
    </item>
    <item>
      <title>I made a prismjs plugin for esbuild.</title>
      <dc:creator>j1ngzoue</dc:creator>
      <pubDate>Thu, 20 Jan 2022 01:29:51 +0000</pubDate>
      <link>https://forem.com/activeguild/i-made-a-prismjs-plugin-for-esbuild-you-can-use-it-if-you-want-584d</link>
      <guid>https://forem.com/activeguild/i-made-a-prismjs-plugin-for-esbuild-you-can-use-it-if-you-want-584d</guid>
      <description>&lt;p&gt;We have created a plugin that allows you to use the same settings when migrating from prismjs + webpack + babel to prismjs + esbuild.&lt;br&gt;
It's easy to use because you just need to migrate the language and plugin information set in &lt;code&gt;.babelrc&lt;/code&gt; to the optional arguments of the new plugin.&lt;br&gt;
&lt;a href="https://github.com/activeguild/esbuild-plugin-prismjs" rel="noopener noreferrer"&gt;https://github.com/activeguild/esbuild-plugin-prismjs&lt;/a&gt;&lt;/p&gt;

</description>
      <category>esbuild</category>
      <category>babel</category>
      <category>prismjs</category>
    </item>
    <item>
      <title>🔍Visualizing the Calling Hierarchy of React Components in the Browser😊</title>
      <dc:creator>j1ngzoue</dc:creator>
      <pubDate>Tue, 04 Jan 2022 16:46:00 +0000</pubDate>
      <link>https://forem.com/activeguild/visualize-the-react-component-in-a-diagram-1hj6</link>
      <guid>https://forem.com/activeguild/visualize-the-react-component-in-a-diagram-1hj6</guid>
      <description>&lt;h2&gt;
  
  
  Introduce
&lt;/h2&gt;

&lt;p&gt;It is very difficult to grasp the whole picture of a component just by looking at the code such as vscode. We often use tools such as Figma to create diagrams and sequences, but this is a very costly process. In order to solve this problem, we have created and released a library to visualize react components as diagrams in a browser. It is still a work in progress, so many considerations may be missing.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://hardcore-fermat-22326b.netlify.app/" rel="noopener noreferrer"&gt;Demo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/activeguild/react-component-analyzer" rel="noopener noreferrer"&gt;react-component-analyzer&lt;/a&gt; is a library that is useful when exchanging PR or design discussions with friends, as it allows you to visualize the component tree as a diagram and discuss it based on a common understanding. It will also help you to understand the scope of impact when you modify the implementation.&lt;br&gt;
I hope it helps you to design better components.&lt;/p&gt;
&lt;h2&gt;
  
  
  Point
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Using the popular library, &lt;a href="https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/typescript-estree" rel="noopener noreferrer"&gt;@typescript-eslint/typescript-estree&lt;/a&gt; AST to do the analysis.&lt;/li&gt;
&lt;li&gt;By using VSCode's schema in the Browser, you can quickly check the implementation of components you are interested in.&lt;/li&gt;
&lt;li&gt;If you are using vite without setting it in the config file, you can resolve the alias from vite.config.ts.&lt;/li&gt;
&lt;li&gt;It uses &lt;a href="https://github.com/PrismJS/prism/" rel="noopener noreferrer"&gt;prismjs&lt;/a&gt;, which allows for code reading that is more like an IDE.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyizkb6umpc8zoyaykv7f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyizkb6umpc8zoyaykv7f.png" alt=" " width="800" height="200"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Install
&lt;/h2&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;-D&lt;/span&gt; visualize-react-component
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Usage
&lt;/h2&gt;

&lt;p&gt;By specifying the React root file and the component files, it will parse them and output the &lt;code&gt;stats.html&lt;/code&gt; file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm run rca ./src/main.tsx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I'm waiting for your feedback.&lt;/p&gt;

</description>
      <category>react</category>
      <category>typescript</category>
      <category>plugin</category>
      <category>diagram</category>
    </item>
    <item>
      <title>Operation on the browser of Github is fast with k</title>
      <dc:creator>j1ngzoue</dc:creator>
      <pubDate>Wed, 24 Nov 2021 04:27:36 +0000</pubDate>
      <link>https://forem.com/activeguild/operation-on-the-browser-of-github-is-fast-with-k-3c5o</link>
      <guid>https://forem.com/activeguild/operation-on-the-browser-of-github-is-fast-with-k-3c5o</guid>
      <description>&lt;p&gt;Once you get used to operating Github on your browser, it will be faster to use commands.&lt;br&gt;
You can also search for files in the repository, so it seems that you can reduce the frequency of switching to the mouse.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.github.com/ja/get-started/using-github/github-command-palette" rel="noopener noreferrer"&gt;https://docs.github.com/ja/get-started/using-github/github-command-palette&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F69nka5zlz9sb5j94z4vv.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F69nka5zlz9sb5j94z4vv.gif" alt=" " width="800" height="461"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>github</category>
      <category>keyboard</category>
      <category>shortcut</category>
    </item>
    <item>
      <title>Resolve types using the typescript plugin for CSS modules available in vite</title>
      <dc:creator>j1ngzoue</dc:creator>
      <pubDate>Thu, 11 Nov 2021 01:23:56 +0000</pubDate>
      <link>https://forem.com/activeguild/i-made-a-typescript-plugin-for-css-modules-that-can-be-used-with-vite-3ofg</link>
      <guid>https://forem.com/activeguild/i-made-a-typescript-plugin-for-css-modules-that-can-be-used-with-vite-3ofg</guid>
      <description>&lt;p&gt;You can resolve the read type of &lt;code&gt;preprocessorOptions&lt;/code&gt; set in the&lt;code&gt;vite.config.ts&lt;/code&gt; file.&lt;br&gt;
Click &lt;a href="https://github.com/activeguild/ts-css-modules-vite-plugin" rel="noopener noreferrer"&gt;here&lt;/a&gt; for the package repository&lt;/p&gt;
&lt;h2&gt;
  
  
  Install
&lt;/h2&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;-D&lt;/span&gt; ts-css-modules-vite-plugin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Add it to the &lt;code&gt;tsconfig.json&lt;/code&gt;
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"compilerOptions"&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="err"&gt;...&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"plugins"&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="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ts-css-modules-vite-plugin"&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="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh4gxbmud6cljxk570pit.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh4gxbmud6cljxk570pit.gif" alt=" " width="453" height="152"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Resolve the &lt;code&gt;vite.config.ts&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Resolve the &lt;code&gt;preprocessorOptions&lt;/code&gt; setting within the plugin.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;path&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;defineConfig&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;vite&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nf"&gt;defineConfig&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;css&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;preprocessorOptions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;scss&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;additionalData&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`@use "@/styles" as common;`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nf"&gt;importer&lt;/span&gt;&lt;span class="p"&gt;(...&lt;/span&gt;&lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@/styles&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
          &lt;span class="p"&gt;}&lt;/span&gt;

          &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="na"&gt;file&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;__dirname&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./src/assets/styles&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="p"&gt;};&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;

    &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>typescript</category>
      <category>cssmodules</category>
      <category>vite</category>
      <category>plugin</category>
    </item>
  </channel>
</rss>
