Error in D:\项目react\library\node_modules\antd\lib\style\color\bezierEasing.less (line 110, column 0)

报错

Failed to compile.

// https://github.com/ant-design/ant-motion/issues/44
.bezierEasingMixin();
^
Inline JavaScript is not enabled. Is it set in your options?
      Error in D:\项目react\library\node_modules\antd\lib\style\color\bezierEasing.less (line 110, column 0)
ERROR in ./src/login/login.less (./node_modules/css-loader/dist/cjs.js!./node_modules/less-loader/dist/cjs.js!./src/login/login.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?
      Error in D:\项目react\library\node_modules\antd\lib\style\color\bezierEasing.less (line 110, column 0)

webpack compiled with 1 error

解决办法

function getLessOptions(loaderContext, loaderOptions) {
  const options = (0, _clone.default)(loaderOptions.lessOptions ? typeof loaderOptions.lessOptions === 'function' ? loaderOptions.lessOptions(loaderContext) || {} : loaderOptions.lessOptions : {});
  const lessOptions = {
    plugins: [],
    relativeUrls: true,
  // 在这个位置添加这行代码==============================================
    javascriptEnabled: true,
    // We need to set the filename because otherwise our WebpackFileManager will receive an undefined path for the entry
    filename: loaderContext.resourcePath,
    ...options
  };
  lessOptions.plugins.unshift(createWebpackLessPlugin(loaderContext));
  const useSourceMap = typeof loaderOptions.sourceMap === 'boolean' ? loaderOptions.sourceMap : loaderContext.sourceMap;

  if (useSourceMap) {
    lessOptions.sourceMap = {
      outputSourceFiles: true
    };
  }

  return lessOptions;
}

你可能感兴趣的:(react.js,less,javascript)