如何从角度产品构建中排除node_modules中的某些文件夹

时间:2020-04-01 12:56:30

标签: angular typescript

我已经使用angular 9创建了一个应用程序。我试图排除在 ng build --prod 期间最小化node_modules内部的特定文件夹(lib)。 enter image description here 我这样做是因为lib文件夹中包含已经最小化的文件,而生产版本又将其最小化,这可能会破坏may app的功能。有人可以帮我吗?

1 个答案:

答案 0 :(得分:0)

嗨,我希望这会有所帮助。您可以使用cpx库。链接:

https://www.npmjs.com/package/cpx

在package.json中的脚本中:

"modify-highstock": "cpx \"modifications/highstock.d.ts\" \"node_modules/highcharts\""

以上脚本将用“ modifications / highstock.d.ts”替换文件“ node_modules / highcharts”。

同样,您也可以删除文件。

因此您可以使用:

"build": "npm run modify-highstock && npm run 4g-mem-limits && npm run build-glapp",

构建之前必须运行的脚本。

希望这会有所帮助。

相关问题