title: Laravel + Flatpicker: How to Install using NPM
body: <p>Did is what I did so far</p>
  <ol>
  <li><code>npm i flatpickr --save</code></li>
  <li>Add <code>@import &quot;~flatpickr/dist/flatpickr.css&quot;;</code> to the app.scss</li>
  <li>index.blade.php</li>
  </ol>
  <pre class="lang-php prettyprint-override"><code>@section('content')
  &lt;div class=&quot;form-group&quot;&gt;
  &lt;label for=&quot;loaned&quot;&gt;Loaned&lt;/label&gt;
  &lt;input type=&quot;date&quot; class=&quot;form-control&quot; name=&quot;loaned&quot; id=&quot;loaned&quot;&gt;
  &lt;/div&gt;
  @endsection
  
  @section('scripts')
      &lt;script&gt;
          flatpickr('#loaned')
      &lt;/script&gt;
  @endsection
  </code></pre>
  <p>I get an error, &quot;flatpickr is not defined&quot;. I read the documentation but it, I don't know what to do with this part:</p>
  <pre class="lang-php prettyprint-override"><code>// commonjs
  const flatpickr = require(&quot;flatpickr&quot;);
  
  // es modules are recommended, if available, especially for typescript
  import flatpickr from &quot;flatpickr&quot;;
  </code></pre>