Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning: failed to find vite:css-post plugin. It might be an internal bug of UnoCSS #1653

Closed
lightglitch opened this issue Sep 27, 2022 · 15 comments · Fixed by #1654
Closed
Labels

Comments

@lightglitch
Copy link

I'm using pnpm with nuxt 3:

- Operating System: `Windows_NT`
- Node Version:     `v18.9.1`
- Nuxt Version:     `3.0.0-rc.11`
- Nitro Version:    `0.5.4`
- Package Manager:  `pnpm@7.12.2`
- Builder:          `vite`
- User Config:      `-`
- Runtime Modules:  `-`
- Build Modules:    `-`

How can I debug the issue and solve it?

@sudongyuer
Copy link
Member

you can provide a reproduction would be better~

@lightglitch
Copy link
Author

I'm testing with this demo https://github.com/lightglitch/nuxt3-pnpm-monorepo

@zyyv
Copy link
Member

zyyv commented Sep 27, 2022

you can provide a reproduction would be better~

Is this issue about pathe?

@zyyv zyyv linked a pull request Sep 27, 2022 that will close this issue
@lightglitch
Copy link
Author

@chris-zhu I don't think so, I downgraded to 0.45.20 to test it and still happens.

@JackieCheung
Copy link

same issue

@sudongyuer
Copy link
Member

Can you provide a minimal reproduction ?

@mrsai
Copy link

mrsai commented Sep 28, 2022

same question。

@lightglitch
Copy link
Author

@sudongyuer you can use https://github.com/lightglitch/nuxt3-pnpm-monorepo to replicate the issue.

@lightglitch
Copy link
Author

@ydcjeff please reopen this issue because doesn't have nothing to do with pathe.

@zyyv zyyv reopened this Sep 29, 2022
@therealokoro
Copy link
Contributor

Same issue....same setup with mine

  • Operating System: Windows_NT
  • Node Version: v17.4.0
  • Nuxt Version: 3.0.0-rc.11
  • Nitro Version: 0.5.4
  • Package Manager: pnpm@7.11.x
  • Builder: vite

In my case this happens when I run nuxi generate or build.

Unocss recognises and bundles styles in the template but ignores styles in the style tag when I have lang="scss" set on the style tag

see example below

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

<template>
    <div>
        <h1 class="myClass bg-green">Hello from unocss</h1>
    </div>
</template>

<style scoped>
    .myClass{
        @apply text-red; // this is generated in final build
    }
</style>

Notice the lang="scss" below

<style scoped lang="scss">
    .myClass{
        @apply text-red; // this is NOT generated in final build
    }
</style>

@lightglitch
Copy link
Author

With version v0.45.26 I don't get this warning anymore, maybe pathe was responsible for the error.

@therealokoro if your issue is also fixed please close this.

@zyyv zyyv added the vite label Sep 30, 2022
@antfu antfu closed this as completed Sep 30, 2022
@therealokoro
Copy link
Contributor

v0.45.26 doesn't still fix it, Unfortunately s😥

Styles in lang=scss still don't get generate

@antfu
Copy link
Member

antfu commented Sep 30, 2022

@therealokoro Please create a new issue with a minimal reproduction

@lightglitch
Copy link
Author

lightglitch commented Sep 30, 2022

@therealokoro have you installed the loaders for sass? Because I was able to use your example just fine.

@pegiadise
Copy link

minimal repro config:

export default defineConfig({
  publicDir: 'src/assets/libAssets',
  resolve: {
    alias: {
      '@lib': resolve(__dirname, 'src/lib'),
      '@assets': resolve(__dirname, 'src/assets'),
    },
  },
  plugins: [
    unoCSS(),
    vue(),
    dts({
      insertTypesEntry: true,
      outputDir: 'dist/libDist',
    }),
  ],
  build: {
    lib: {
      entry: resolve(__dirname, 'src/lib/main.lib.ts'),
      formats: ['es'],
      name: 'my-lib',
      fileName: 'my-lib',
    },
    rollupOptions: {
      external: ['vue', 'core-js', 'vue-i18n'],
      output: {
        sourcemap: true,
        assetFileNames: 'my-lib.[ext]',
        dir: 'dist/libDist', // THIS IS CAUSING THE ERROR
        globals: {
          vue: 'Vue',
        },
      },
    },
  },
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants