antfu / purge-icons

🎐 Bundles icons on demand
https://www.npmjs.com/package/purge-icons
MIT License
229 stars 18 forks source link

Nuxt production build does not work #22

Open marhali opened 2 years ago

marhali commented 2 years ago

When using nuxt dev mode (npm run dev) everything works as expected. When building for production (via npm run example:build and npm run example:start) no icons are displayed.

Tested this with my own nuxt project as well as the example project provided under this repo.

On production it will just print the plain html tags without the svg replacement:

<div id="__nuxt">
   <!---->
   <div id="__layout">
      <div>
         <div class="text-center p-8">
            <div class="text-gray-600 text-lg">
               <div class="mb-2">
                  <div class="inline-block" style="vertical-align:text-bottom;"></div>
                  <div class="inline-block" style="vertical-align:text-bottom;"></div>
                  <div class="inline-block" style="vertical-align:text-bottom;"></div>
               </div>
               <h1 class="text-lg">
                  @purge-icons/nuxt-example
               </h1>
            </div>
         </div>
      </div>
   </div>
</div>

Info: Also tested deleting cache files as #19 described but this does not solved the problem for me.

Steps to reproduce

  1. Checkout the example nuxt project.
  2. Install deps via npm install
  3. Build for production via npm run example:build
  4. Start nuxt engine via npm run example:start

As described only other sections like the headline will be shown:

purge-icons