【webpack】vue-cli3使用sass-resource

2020-11-08  本文已影响0人  愫幕

第一步:
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')],
            })
        })
}```
上一篇下一篇

猜你喜欢

热点阅读