Vue CLI 3 sass-resources-loader - Options.loaders undefined

前端 未结 1 559
面向向阳花
面向向阳花 2021-02-05 17:32

I was able to successfully configure a new Vue project using the 3.0 version of the CLI to use sass-resource-loader a few weeks ago using the information posted her

相关标签:
1条回答
  • 2021-02-05 17:51

    You use vue-cli@3.x, this probably means that your project uses vue-loader@15.x Since version 15, the vue-loader does not need additional configs for loaders. You can configure only your main webpack loaders.

    const path = require('path')
    
    module.exports = {
      chainWebpack: (config) => {
        config
          .module
          .rule('scss')
          .use('sass-resources-loader')
          .loader('sass-resources-loader')
          .options({
            resources: [
              path.resolve('./src/scss/_variables.scss'),
              path.resolve('./src/scss/_mixins.scss')
            ]
          })
      }
    }
    

    You can also inspect webpack configs using the vue inspect or ./node_modules/.bin/vue-cli-service inspect commands.

    0 讨论(0)
提交回复
热议问题