javascript - 排除 node_modules 缩小以解决具有意外路径的“无法缩小此文件中的代码”
问题描述
当我运行 npm run build ( react-app-rewired build
) 我得到这个编译错误:
Creating an optimized production build...
Failed to compile.
Failed to minify the code from this file:
./node_modules/babel-loader/lib??ref--6-oneOf-2!./node_modules/diffusion/src/node_modules/util/interface.js:127
我正在尝试将excludes属性
config-overrides.js
注入为config.optimization.minimizer[0].options.exclude = /node_modules\/diffusion/;
但这似乎不起作用(既不使用 only /node_modules/
)
有什么帮助吗?
PS。我设法避免在从“生产”到“开发”的配置中完全覆盖“模式”的缩小。
我还注意到我们正在使用 5.9.2 版的扩散库,升级到最新版本后缩小问题就消失了。
不过我的理解是,由于版本 6 中的重大更改,我们需要旧版本。有没有办法只为这个特定的库禁用缩小?
谢谢
解决方案
推荐阅读
- php - 按标题对商店页面上的 WooCommerce 产品进行排序
- c - C pthread 格式化
- git - 了解 Git 历史图表
- git - SubGit:使用 Git 拉取请求描述作为 SVN 提交消息
- laravel - 如何在自定义请求类中验证后自定义重定向
- python - word2vec:具有预训练模型的用户级、文档级嵌入
- html - 用于移动错误的 Bootstrap4 导航栏
- android - AdMob 广告未在 Google Play 中展示
- string - 如何在 React 中逐个字母地删除段落的动画
- reactjs - 测试 React Redux - 无法读取未定义或包装器未定义的属性