webpack打包less出错

webpack打包less文件的时候出现了以下错误 :

ERROR in ./node_modules/_antd@4.3.0@antd/lib/button/style/index.less (./node_modules/_css-loader@3.5.3@css-loader/dist/cjs.js!./node_modu
les/_less-loader@6.1.0@less-loader/dist/cjs.js!./node_modules/_antd@4.3.0@antd/lib/button/style/index.less)
Module build failed (from ./node_modules/_less-loader@6.1.0@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?
Error in ~/landing/node_modules/_antd@4.3.0@antd/lib/style/color/bezierEasing.less (line 110, column 0)
@ ./node_modules/_antd@4.3.0@antd/lib/button/style/index.less 2:26-159
@ ./node_modules/_antd@4.3.0@antd/lib/button/style/index.js
@ ./src/Banner3.jsx
@ ./src/index.jsx
@ ./src/index.js

解决

  1.    根据错误提示,访问了https://github.com/ant-design/ant-motion/issues/44
    
  2.  按照大佬们的回到,在less-loader下面加上optipns
    
  		{
  				loader: 'less-loader',
  				options: {
  						javascriptEnabled: true      
  		    	}
  		}
  1.  但是实测发现,依然会报错
    
ERROR in ./node_modules/_antd@4.3.0@antd/lib/grid/style/index.less (./node_modules/_css-loader@3.5.3@css-loader/dist/cjs.js!./node_modules/_less-loader@6.1.0@less-loader/dist/cjs.js??ref--4-2!./node_modules/_antd@4.3.0@antd/lib/grid/style/index.less)
Module build failed (from ./node_modules/_less-loader@6.1.0@less-loader/dist/cjs.js):
ValidationError: Invalid options object. Less Loader has been initialized using an options object that does not match the API schema.
 - options has an unknown property 'javascriptEnabled'. These properties are valid:
   object { lessOptions?, prependData?, appendData?, sourceMap?, implementation? }
    at validate (/home/lxx/tmp/react/landing/node_modules/_schema-utils@2.7.0@schema-utils/dist/validate.js:96:11)
    at Object.lessLoader (/home/lxx/tmp/react/landing/node_modules/_less-loader@6.1.0@less-loader/dist/index.js:22:28)
 @ ./node_modules/_antd@4.3.0@antd/lib/grid/style/index.less 2:26-169
 @ ./node_modules/_antd@4.3.0@antd/lib/grid/style/index.js
 @ ./node_modules/_antd@4.3.0@antd/lib/row/style/index.js
 @ ./src/Content0.jsx
 @ ./src/index.jsx
 @ ./src/index.js
  1.  最终在网上查找到了最正确的答案,将options的代码改为
    
  		{
  				loader: 'less-loader',
  				options: {
  						lessOptions: {
  								javascriptEnabled: true
  						}      
  		    	}
  		}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值