0

version 4.3 of vue cli is in use.
I hope the external css file will be created separately after the build.
I have to use that file somewhere else.

**current result** 
root
  ┗dist
    ┗css
      ┗app.dsfe23f.css  
    ┗js
      ┗app.ds3fe23f.js
      ┗app.ds1fe23f.map
      ┗chunk-vendors.ds3fe23f.js
      ┗chunk-vendors.ds1fe23f.map   
  ┗public
    ┗index.html
  ┗src
    ┗assets
      ┗css
        ┗GiftStyle.css
    ┗router
      ┗index.js 
    ┗view
      ┗Home.vue
      ┗Gift.vue
    ┗App.vue
    ┗main.vue

**What I want** 
root
  ┗dist
    ┗css
      ┗app.dsfe23f.css
      ┗GiftStyle.dsf231.css  
    ┗js
      ┗app.ds3fe23f.js
      ┗app.ds1fe23f.map
      ┗chunk-vendors.ds3fe23f.js
      ┗chunk-vendors.ds1fe23f.map   
  ┗public
    ┗index.html
  ┗src
    ┗assets
      ┗css
        ┗GiftStyle.css
    ┗router
      ┗index.js 
    ┗view
      ┗Home.vue
      ┗Gift.vue
    ┗App.vue
    ┗main.vue

*****vue.config.js 
const ExtractTextPlugin = require('mini-css-extract-plugin')

module.exports = {
  
  chainWebpack: config => { config.plugin('extract-css').use(ExtractTextPlugin, [{
        filename:  'css/[name].css',
        allChunks: true
      }])
    
  },
  configureWebpack:{
    
    
  },
  
  assetsDir: 'resources'  
}
ssong
  • 11
  • 3
  • Can we see your `.vuerc` configuration file? Also, did you try enabling the `css.extract` option? You could also play around with the [mini-css-extract-plugin](https://github.com/webpack-contrib/mini-css-extract-plugin). – nunop Jul 05 '20 at 11:59
  • The file only has basic contents. Please tell me how to write "MiniCssExactPlugin" in the "vue.config.js" file. – ssong Jul 06 '20 at 04:09
  • You could try the property `css: { extract: true }` in your `vue.config.js` – nunop Jul 06 '20 at 07:43
  • Alternatively to enabling the css extract property, you can [pass an object of options for the mini-css-extract-plugin](https://cli.vuejs.org/config/#css-extract). – nunop Jul 06 '20 at 07:54
  • I tried "css: { extract: true }" but failed. – ssong Jul 07 '20 at 01:05

0 Answers0