L
L
lavezzi12021-01-21 07:18:36
Vue.js
lavezzi1, 2021-01-21 07:18:36

Why does css written in components end up in after build?

Hello. I assembled the vue component library using rollup, I import it into the application: The button itself looks something like this, simplified for example:

import { VButton } from '@compnany/ui';


<template>
  <button class="v-button">
      <slot/>
  </button>
</template>

<script>
export default {}
</script>

<style lang="postcss">
.v-button {
  background-color: red;
}
.v-button:hover {
  background-color: blue;
}
</style>


Everything works great, though! For some reason, I'm doing a build of the project, the css of the component gets into <style>the page tag, and not into the css file. The project is deployed on vue-cli latest version.

Ideally, I would like the css of a particular component to get into the page bundle (I use lazy load in router).

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question