map文件是帮助我们查看报错的位置的。

1.方案一

map文件由devtool属性控制,如果不想要map,注释掉就可以,大约webpack.config.prod.js第57行;

// devtool: shouldUseSourceMap ? 'source-map' : false,

2.方案二

(1)安装 react-app-rewired

yarn add react-app-rewired

(2)配置 config-overrides.js ,例如:

const { injectBabelPlugin } = require('react-app-rewired');
const rewireLess = require('react-app-rewire-less');

module.exports = function override(config, env) {
  config = injectBabelPlugin(
    ['import', { libraryName: 'antd', libraryDirectory: 'es', style: true }], // change importing css to less
    config,
  );
  config.devtool = false; // 关掉 sourceMap 
  config = injectBabelPlugin('babel-plugin-transform-decorators-legacy', config); // 支持装饰器
  config = rewireLess.withLoaderOptions({
    modifyVars: { '@primary-color': '#1890ff' },
    javascriptEnabled: true,
  })(config, env);
  return config;
};

.

相关文章:

  • 2022-12-23
  • 2021-11-27
  • 2021-08-17
  • 2022-12-23
  • 2021-06-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-18
  • 2022-12-23
  • 2021-12-05
  • 2021-07-24
  • 2022-12-23
相关资源
相似解决方案