【webpack】vue-cli3使用sass-resources-loader

第一步:
yarn add sass-resources-loader

第二步:

const path = require('path');
const resolve = dir => {
    return path.join(__dirname, dir)
}

module.exports = {
    publicPath: './',
    devServer: {
        port: port,
        open: false,
        overlay: {
            warnings: false,
            errors: false   // 关闭eslint在屏幕上的error
        },
    },
    chainWebpack: config => {
        const oneOfsMap = config.module.rule('scss').oneOfs.store
        oneOfsMap.forEach(item => {
            item
            .use('sass-resources-loader')
            .loader('sass-resources-loader')
            .options({
                resources: [resolve('src/assets/scss/xxxx.scss')],
            })
        })
}```

你可能感兴趣的:(【webpack】vue-cli3使用sass-resources-loader)