Autoprefixer error & warning & solution All In One


Autoprefixer error & warning & solution All In One

Autoprefixer warning

Second Autoprefixer control comment was ignored. Autoprefixer applies control comment to whole block, not to next rules.

.mult-lines-text-ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    /*! autoprefixer: off */
    -webkit-box-orient: vertical;
    /* autoprefixer: on */
    -webkit-line-clamp: 3;
}

上面这种做法适用于8.4以下版本,推荐6.x版本。

从8.4版本开始,更改了注释规则。
autoprefixer: off会使后面所有的代码都生效。在使用过程中,还是出现以下警告:

Second Autoprefixer control comment was ignored. Autoprefixer applies control comment to whole block, not to next rules.

solution ?

    config = merge(config, {
      // ...
    }, {
        stats: {
            // warnings: false,
            // errors: true,
            // warningsFilter: ['filter', /filter/, (warning) => true],
            // warningsFilter: [
            //     './~/postcss-loader!./src/components/Navigator/Navigator.css'
            // ],
            warningsFilter: [
                (warning) => {
                    console.log('warning =', warning);
                    if(warning.includes('Second Autoprefixer control comment was ignored.')) {
                        return false;
                    }
                    return true;
                },
            ],
            warningsFilter: [
                (warning) => {
                    // console.log('\n? warning =', warning);
                    if(warning.includes('Second Autoprefixer control comment was ignored.')) {
                        console.log('\n? Autoprefixer warning');
                        return false;
                    }
                    return true;
                },
            ],
        },
    });

OK

const warning = `warning = ./views/tools/audience-package/main/components/drawer/components/detail/facebook/index.vue?vue&type=style&index=0&lang=scss& (../node_modules/_css-loader@1.0.0@css-loader!../node_modules/_vue-loader@15.4.0@vue-loader/lib/loaders/stylePostLoader.js!../node_modules/_postcss-loader@3.0.0@postcss-loader/src!../node_modules/_sass-loader@7.3.1@sass-loader/dist/cjs.js??ref--7-3!../node_modules/_vue-loader@15.4.0@vue-loader/lib?cacheDirectory=true!./views/tools/audience-package/main/components/drawer/components/detail/facebook/index.vue?vue&type=style&index=0&lang=scss&)
Module Warning (from ../node_modules/_postcss-loader@3.0.0@postcss-loader/src/index.js):
Warning

(93:3) Second Autoprefixer control comment was ignored. Autoprefixer applies control comment to whole block, not to next rules.`

warning.includes('Second Autoprefixer control comment was ignored.')
// true

image

image

        stats: {
            // warnings: false,
            // errors: true,
            // warningsFilter: ['filter', /filter/, (warning) => true],
            // warningsFilter: [
            //     './~/postcss-loader!./src/components/Navigator/Navigator.css'
            // ],
            warningsFilter: [
                (warning, i) => {
                    // console.log('\n? warning =', warning);
                    if(warning.includes('Second Autoprefixer control comment was ignored.')) {
                        console.log('\n? Autoprefixer warning i =', i);
                        // ? Autoprefixer warning i = undefined
                        return false;
                    }
                    return true;
                },
            ],
        },

image

refs


Flag Counter

?xgqfrms 2012-2020

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有??xgqfrms, 禁止转载 ???,侵权必究??!