Skip to content

imported lib files are not scanned  #86

Open
@germsb

Description

Describe

In monorepo, I have two project, one component library, one app. Both use vite, windicss and vue.

The library export tree-shakable components

export {default as TestComp1} from './components/Test1.vue';
export {default as TestComp2} from './components/Test2.vue';

TestComp1 looks like this:

<template>
    <div class="bg-pink-500 text-white">hello</div>
</template>

<script setup lang="ts"></script>

Then I import library component in the app

<template>
    <div class="bg-purple-400">
        <TestComp1/>
    </div>
</template>

<script setup lang="ts">
import {TestComp1} from 'windicss-lib';
</script>

bg-pink-500 and text-white classes are not generated.

Imgur

I have checked the plugin options but I did not find a solution.
If i Include the node_modules for scan, I'm afraid of ending up with too much CSS, because it will scan all the components even the ones I don't use.

Edit:

indeed, if I add my lib to the scan.dir option, it is scanned as a whole, so at the end, I will have to purge the final bundle.

Versions

  • vite-plugin-windicss: 0.8.2
  • vite: 2.05
  • framework(vue/react/svelte/etc): vue 3.0.7

Additonal Context

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions