Vue file, how to extract css file

currently I want to extract the styles written in the style in the * .vue file into a file and look it up online, but basically to no avail.

Feb.28,2021

assume that under the assets directory of src , there is a style folder with a test.css file, so that the introduction method in the .vue file is

.
<style lang="css">
@import '~@/assets/style/test.css'
</style>

// webpack.config.js
var ExtractTextPlugin = require("extract-text-webpack-plugin")
module.exports = {
  module: {
    rules: [
      {
        test: /\.vue$/,
        loader: 'vue-loader',
        options: {
          extractCSS: true
        }
      }
    ]
  },
  plugins: [
    new ExtractTextPlugin("style.css")
  ]
}

in this way, the styles in * .vue can be extracted to the specified path. I didn't succeed because of the version of vue-loader.

Menu