iview/vue-cli-plugin-iview

WARN conflicting versions for project dependency "less"

9monsters opened this issue · 3 comments

The newest less version is 3.0.4, but our plugin using 2.7.3. When I run serve , I got

 WARN  conflicting versions for project dependency "less":

- ^3.0.4 injected by generator "undefined"
- ^2.7.3 injected by generator "vue-cli-plugin-iview"

Using newer version (^3.0.4), but this may cause build errors.

and Vue ui console print

$ vue-cli-service serve --mode development --dashboard
 INFO  Starting development server...

 84% chunk reviving RecordIdsPlugin ERROR  Failed to compile with 1 errors上午11:13:35


 error  in ./src/iview-variables.less

Module build failed (from ./node_modules/less-loader/dist/cjs.js):


// https://github.com/ant-design/ant-motion/issues/44
.bezierEasingMixin();
^
Inline JavaScript is not enabled. Is it set in your options?
      in /Users/me/Desktop/Archimedesz/kedu/learning-admin-frontend/node_modules/iview/src/styles/color/bezierEasing.less (line 110, column 0)

 @ ./src/iview-variables.less 4:14-226 14:3-18:5 15:22-234
 @ ./src/plugins/iview.js
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://192.168.41.186:8081/sockjs-node (webpack)/hot/dev-server.js ./src/main.js

It seems that less 3.x's bug, I guess needed to add javascript option in less loader config :

{
   loader: "less-loader",
   options: {
        javascriptEnabled: true
    }
}

It seems that less 3.x's bug, I guess needed to add javascript option in less loader config :

{
   loader: "less-loader",
   options: {
        javascriptEnabled: true
    }
}

you can config these all by yourself:

vue.config.js
you can put it in your project root

module.exports = {
  css: {
    loaderOptions: {
      less: {
        javascriptEnabled: true
      }
    }
  }
}

@moux1024 Thank you , I got it