[Vuejs]-How can extract css from nuxt version3 in build stage

0๐Ÿ‘

I had the same problem

in nuxt.config ts you need to set builder:"webpack" and write your config in webpack section f.e.

export default defineNuxtConfig({
  builder:"webpack",
  css:["~~/assets/sass/_index.scss"],// your css
  webpack: {
    extractCSS: true,
    optimization: {
      splitChunks: {
        cacheGroups: {
          styles: {
            name: 'styles',
            test: /\.(css|vue)$/,
            chunks: 'all',
            enforce: true
          }
        }
      }
    }
  }
})

0๐Ÿ‘

this worked for me:

export default defineNuxtConfig({
  ...
   experimental: {
     inlineSSRStyles: false,
   },
  ...
});

Leave a comment