<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="234599" data-post-id="234599">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="kalkatfyodor" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  kalkatfyodor
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I finally solved it. And I haven’t used any npm install bullshit as you both suggested.<br>
The problem was in esbuild/Phoenix and not in Alpine.</p>
<p>Not for you, who instead of helping were attacking and bullying me by trying to make me look bad, but for others who because of the lack of up to date docs will struggle, I will offer this solution:</p>
<p>If you hate node package manager and you wanted to escape it and not to go back to it do this:</p>
<ol>
<li>download the JavaScript file here: <code>https://unpkg.com/alpinejs@3.7.0/dist/cdn.min.js</code></li>
<li>rename this file to <code>alpine.js</code> or add the version number to keep track</li>
<li>put this file inside assets/vendor folder (where the topbar.js file is)</li>
<li>in <code>assets/js/app.js</code> file make these changes:</li>
</ol>
<pre data-code-wrap="elixir"><code class="lang-elixir">import topbar from "../vendor/topbar";
import Alpine from "../vendor/alpine"; &lt;-- add this line
</code></pre>
<p>then:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">import Alpine from "../vendor/alpinejs_3_7_0";

window.Alpine = Alpine; &lt;-- add this line
Alpine.start(); &lt;-- add this line

let csrfToken = document
</code></pre>
<p>and:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">let csrfToken = document
  .querySelector("meta[name='csrf-token']")
  .getAttribute("content");

let hooks = {}; &lt;-- add this line
let liveSocket = new LiveSocket("/live", Socket, {
  params: { _csrf_token: csrfToken },
  hooks: hooks, &lt;-- add this line
  dom: { &lt;-- add this line
    onBeforeElUpdated(from, to) { &lt;-- add this line
      if (from._x_dataStack) { &lt;-- add this line
        window.Alpine.clone(from, to); &lt;-- add this line
      } &lt;-- add this line
    }, &lt;-- add this line
  }, &lt;-- add this line
});
</code></pre>
<ol start="5">
<li>open <code>config/config.exs</code> file and find there:<br>
<code>--target=es2016</code> and change it to <code>--target=es2017</code></li>
<li>restart the server</li>
<li>Alpine is now working</li>
</ol> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="234599" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/alpine-js-loaded-2-times/44345/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-234599" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="234599"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #12"></div>
  </section>
</div>
    <div class="postbit" id="234611" data-post-id="234611">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="derek-zhou" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/derek-zhou/120/19943_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  derek-zhou
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="kalkatfyodor" data-post="13" data-topic="44345">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/k/fbc32d/48.png" class="avatar"> kalkatfyodor:</div>
<blockquote>
<p>open <code>config/config.exs</code> file and find there:<br>
<code>--target=es2016</code> and change it to <code>--target=es2017</code></p>
</blockquote>
</aside>
<p>Interesting. The only thing new is this, so esbuild’s es2016 transpiling was the culprit?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="234611" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/alpine-js-loaded-2-times/44345/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-234611" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="234611"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #13"></div>
  </section>
</div>
    <div class="postbit" id="234614" data-post-id="234614">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Sebb" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Sebb/120/21818_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Sebb
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>quote from the guide <strong>you</strong> posted above:</p>
<blockquote>
<p>Alpine ^3.5.0 now targets es2017 so make sure you update <code>config/config.exs</code> . Check the last commit in the repo for a quick fix.</p>
</blockquote> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="234614" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/alpine-js-loaded-2-times/44345/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-234614" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="234614"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #14"></div>
  </section>
</div>
    <div class="postbit" id="234619" data-post-id="234619">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="derek-zhou" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/derek-zhou/120/19943_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  derek-zhou
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Thanks. I actually did not read the guide carefully. I am using es2017 too, but for a different reason: es2016 does not even support async function, which sucks badly.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="234619" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/alpine-js-loaded-2-times/44345/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-234619" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="234619"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #15"></div>
  </section>
</div>
    <div class="postbit" id="234630" data-post-id="234630">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="dimitarvp" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/dimitarvp/120/38664_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  dimitarvp
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>btw if you want to express a diff, the forum system has a facility for that: put the <code>diff</code> word after the triple backticks like so: ```diff</p>
<p>So your code can look like this:</p>
<pre data-code-wrap="diff"><code class="lang-diff">let csrfToken = document
  .querySelector("meta[name='csrf-token']")
  .getAttribute("content");

+ let hooks = {};
let liveSocket = new LiveSocket("/live", Socket, {
  params: { _csrf_token: csrfToken },
+  hooks: hooks,
+  dom: {
+    onBeforeElUpdated(from, to) {
+      if (from._x_dataStack) {
+        window.Alpine.clone(from, to);
+      }
+    },
+  },
});
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="234630" data-batch-url="/posts/batch_likers">
                        5
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/alpine-js-loaded-2-times/44345/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-234630" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="234630"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-most-liked cat-most-liked" title="One of the top 3 liked posts in this thread!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>