ivew定制主题 less ^3.0 时报错 .bezierEasingMixin(); Inline JavaScript is not enabled. Is it set in your op.

iview 升级至3.0以上后,npm run dev报错.bezierEasingMixin(); Inline JavaScript is not enabled.
查阅好多,大致两种方法
第一种:
将less版本将至2.7.3
第二种:
找到less-loader,在配置项添加options.javascriptEnabled = true

function lessLoader(source) {
  var loaderContext = this;
  var options = (0, _getOptions2.default)(loaderContext);
  
  // **options.javascriptEnabled = true** 
  
  var done = loaderContext.async();
  var isSync = typeof done !== 'function';

  if (isSync) {
    throw new Error('Synchronous compilation is not supported anymore. See https://github.com/webpack-contrib/less-loader/issues/84');
  }

  (0, _processResult2.default)(loaderContext, render(source, options));
}

但是,貌似都不行啊,不理想
还有一种方法,找到 build/utils.js文件

return {
    css: generateLoaders(),
    postcss: generateLoaders(),
    less: generateLoaders('less', {javascriptEnabled: true}),
    sass: generateLoaders('sass', { indentedSyntax: true }),
    scss: generateLoaders('sass'),
    stylus: generateLoaders('stylus'),
    styl: generateLoaders('stylus')
  }

ok,我更喜欢这种方法,团队合作不需要每个人都去修改,也不小降低自己less版本

你可能感兴趣的:(Vue,iview,less)