Webpack自动前缀程序问题 .browserslitrc被忽略

问题描述

我正在使用webpack,postcss,browserslit和autoprefixer。除自动前缀外,其他所有功能都正常运行。

当我编写此CSS代码时,输​​出是相同的。我在https://autoprefixer.github.io/中检查了.css代码和browserslist配置,我的配置文件是否正确?还是我错了?

.block {
    display:flex;
}

但是它必须是这样的:

.block {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
}

这是我的webpack.config.js

const autoprefixer = require('autoprefixer');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const TerserJSPlugin = require('terser-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');

module.exports = (env,argv) => {
    return {
        entry: {
            bundle: './src/index.js',},output: {
            filename: '[name].js',optimization: {
            minimizer: [
                new TerserJSPlugin({
                    sourceMap: true,}),new OptimizeCSSAssetsPlugin({
                    cssProcessorOptions: {
                        map: {
                            inline: false,annotation: true,],plugins: [
            new CleanWebpackPlugin(),new MiniCssExtractPlugin({
                moduleFilename: (chunk) => {
                    return chunk.name === 'script' ? 'style.css' : '[name].css';
                },chunkFilename: '[id].css',devtool:
            argv.mode === 'development'
                ? 'cheap-module-source-map'
                : 'source-map',mode: 'development',module: {
            rules: [
                {
                    test: /\.js$/,exclude: /node_modules/,use: {
                        loader: 'babel-loader',options: {
                            plugins: [
                                '@babel/plugin-proposal-class-properties',presets: ['@babel/preset-env'],{
                    test: /\.(sa|sc|c)ss$/,use: [
                        MiniCssExtractPlugin.loader,'css-loader',{
                            loader: 'postcss-loader',options: {
                                postcssOptions: {
                                    plugins: [autoprefixer()],'sass-loader',externals: {
            jquery: 'jQuery',};
};

还有.browserslistrc

last 2 versions
> 0.5%
ie >= 11

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...