huangshuwei / blog

🈲黄书伟的个人博客
54 stars 8 forks source link

webpack4.x 同时使用postcss 和 sass 配置 #17

Open huangshuwei opened 6 years ago

huangshuwei commented 6 years ago

错误的loader配置:

// webpack.config.js
     {
                test: /\.(css|postcss|sass|scss)$/,
                use: [
                    'style-loader',
                    'css-loader',
                    'postcss-loader',
                    'sass-loader'
                ]
            },

正确的配置:

// webpack.config.js
       {
                test: /\.(postcss)$/,
                use: [
                    'style-loader',
                    'css-loader',
                    'postcss-loader'
                ]
            },
            {
                test: /\.(css|sass|scss)$/,
                use: [
                    'style-loader',
                    'css-loader',
                    'sass-loader',
                    'resolve-url-loader'
                ]
            }