Vue+Vuetify:deploy出现很多warning

warning

chunk chunk-13cb823d [mini-css-extract-plugin]
Conflicting order. Following module has been added:
* css ./node_modules/css-loader/dist/cjs.js??ref--10-oneOf-3-1!./node_modules/postcss-loader/src??ref--10-oneOf-3-2!./node_modules/sass-loader/dist/cjs.js??ref--10-oneOf-3-3!./node_modules/vuetify/src/components/VInput/VInput.sass
despite it was not able to fulfill desired ordering with these modules:
* css ./node_modules/css-loader/dist/cjs.js??ref--10-oneOf-3-1!./node_modules/postcss-loader/src??ref--10-oneOf-3-2!./node_modules/sass-loader/dist/cjs.js??ref--10-oneOf-3-3!./node_modules/vuetify/src/components/VTextField/VTextField.sass
- couldn't fulfill desired order of chunk group(s) , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
- while fulfilling desired order of chunk group(s) , , ,

configureWebpack: (config) => {
    if (process.env.NODE_ENV === 'production') {
      config.mode = "production";
      config["performance"] = {
        "maxEntrypointSize": 10000000,
        "maxAssetSize": 10000000
      }
      const miniCssExtractPlugin = config.plugins.find(
        plugin => plugin.constructor.name === 'MiniCssExtractPlugin'
      )
      if (miniCssExtractPlugin) {
        miniCssExtractPlugin.options.ignoreOrder = true
      }
    }
  },

  

我的解决方法是ignore warning Obviously。因为项目已经做完发布了,不能大改动了。哈哈😄 在vue.config.js文件里:

其他方法是:

Eslint

If you are worked in a js or vue project with eslint, you also can easily achieve it by a eslint plugin: eslint-plugin-simple-import-sort.

the first you need to do is install it. npm install eslint-plugin-simple-import-sort -D or yarn add eslint-plugin-simple-import-sort -D

Then you should add it in your .eslintrc.js file(or other eslint config file)

module.exports = {
    // ...
    plugins: ["simple-import-sort"],
    rules: {
    // ...
    "simple-import-sort/imports": "error",
}
}

Finally run eslint fix to auto fix import order. example: npm run lint:fix

Last of the last, you are better to use husky and add npm run lint:fix in husky script, that will let eslint auto to adjust import order before you commit or push(depend you husky config)

 

posted @ 2022-06-15 15:42  Bella...NET开发  阅读(593)  评论(0)    收藏  举报