gpt4 book ai didi

html - 如何删除 node_modules 文件夹中不需要的文件 Angular 5

转载 作者:太空宇宙 更新时间:2023-11-03 22:20:51 24 4
gpt4 key购买 nike

我想删除 node_modules 文件夹中不需要的文件以减小大小和快速加载。我的应用程序在加载时太慢我不知道是什么原因。任何人都可以建议我最小化文件大小。

这是我的package.json

    {
"name": "CoreUI",
"version": "1.0.0-alpha.4",
"description": "Open Source Bootstrap Admin Template",
"author": "",
"url": "http://coreui.io",
"copyright": "Copyright 2017 creativeLabs Łukasz Holeczek",
"license": "MIT",
"angular-cli": {},
"scripts": {
"ng": "ng",
"start": "ng serve",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^5.2.2",
"@angular/common": "^5.2.2",
"@angular/compiler": "^5.2.2",
"@angular/core": "^5.2.2",
"@angular/forms": "^5.2.2",
"@angular/http": "^5.2.2",
"@angular/platform-browser": "^5.2.2",
"@angular/platform-browser-dynamic": "^5.2.2",
"@angular/platform-server": "^5.2.2",
"@angular/router": "^5.2.2",
"@angular/upgrade": "2.4.9",
"angular-split": "^1.0.0-rc.3",
"angular2-fontawesome": "^0.9.3",
"angular2-image-upload": "^1.0.0-rc.0",
"angular2-multiselect-dropdown": "^2.2.1",
"angular2-notifications": "^1.0.2",
"angular2-ui-switch": "^1.2.0",
"chart.js": "^2.5.0",
"chart.piecelabel.js": "^0.10.0",
"core-js": "2.4.1",
"e-ngx-fileupload": "^1.2.0",
"font-awesome": "^4.7.0",
"moment": "2.17.1",
"mydatepicker": "^2.6.1",
"mydaterangepicker": "^4.2.1",
"ng2-bootstrap": "^1.4.0",
"ng2-charts": "^1.5.0",
"ng2-ckeditor": "^1.2.0",
"ng2-drag-drop": "^3.0.2",
"ng2-dragula": "^1.5.0",
"ng2-fancy-image-uploader": "^2.0.1",
"ng2-split": "^0.1.6",
"ng2-split-pane": "^1.4.0",
"ngx-bootstrap": "^2.0.3",
"ngx-chips": "^1.6.7",
"ngx-cookie-service": "^1.0.10",
"ngx-quill": "^3.4.0",
"ngx-quill-editor": "^2.2.2",
"ngx-toggle-switch": "^1.3.9",
"rxjs": "5.2.0",
"ts-helpers": "1.1.2",
"zone.js": "0.7.2"
},
"devDependencies": {
"@angular/cli": "1.0.0-rc.1",
"@angular/compiler-cli": "^5.2.2",
"@types/jasmine": "2.5.45",
"@types/node": "7.0.8",
"codelyzer": "2.0.1",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "3.2.0",
"karma": "1.5.0",
"karma-chrome-launcher": "2.0.0",
"karma-cli": "1.0.1",
"karma-coverage-istanbul-reporter": "0.3.0",
"karma-jasmine": "1.1.0",
"karma-jasmine-html-reporter": "0.2.2",
"protractor": "5.1.1",
"ts-node": "2.1.0",
"tslint": "4.5.1",
"typescript": "^2.6.2"
}
}

我只希望节点模块中存在依赖文件。

提前致谢。

最佳答案

除非您对自己所做的事情有信心,否则不要触摸 node_modules 文件夹?这是正常的。通常,node_module 文件夹的大小稍大一些。这是因为它包含您正在使用的库及其依赖项以及它们的依赖项。

在这里我可以给出一些建议来减少node_modules文件夹的空间使用

  • 尽量使用最新稳定版本的库可能的
  • 使用最少数量的库。 (不只是安装没有目的的图书馆)
  • 如果仅使用 vanilla javascript 就可以完成任务,则不需要为此使用库。

如果您认为自己通过手动编辑 package.json 文件不小心添加和删除了包。只需删除整个 node_modules 目录并运行 npm installyarn install

虽然 node_module 文件夹的大小很大。它们对性能没有太大影响。在运行时,节点知道要执行什么代码,不执行什么代码。

您可以从 this 中找到更多信息文章。

关于html - 如何删除 node_modules 文件夹中不需要的文件 Angular 5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53832497/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com