久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

為什么 Electron 需要保存為開發者依賴?

Why does Electron need to be saved as a developer dependency?(為什么 Electron 需要保存為開發者依賴?)
本文介紹了為什么 Electron 需要保存為開發者依賴?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

根據官網,電子文件的正確保存方法是:

As per the official website, the correct way to save electron files is:

npm install electron --save-dev

運行應用程序實際上需要電子(字面意思是:require()),這與 最高投票答案.那么,如果這是一個例外,我們為什么要做出這個例外呢?

Electron is actually required for running the app (quite literally: require()) and this goes against the top voted answer here. So why do we make this exception, if this is even one?

推薦答案

require 一個包的事實與它是否應該被視為依賴項或 devDependency 無關(在 npm 意義上).例如.許多項目使用 webpack API(即 const webpack = require('webpack')),但將其列為 devDependency.

The fact that you require a package is irrelevant to whether it should be considered a dependency or a devDependency (in the npm sense). E.g. many projects use webpack API (i.e. const webpack = require('webpack')) but list it as a devDependency.

原因在你鏈接到的帖子中也有解釋:當你發布你的包時,如果消費者項目需要其他包來使用你的包,那么這些必須列為 dependencies.

The reason is also explained in the post you link to: when you publish your package, if the consumer project needs other packages to use yours, then these must be listed as dependencies.

如果您的包僅使用某些模塊來構建、測試或將它們捆綁到 dist 文件中(即消費者項目將使用什么),那么這些模塊不應在 dependencies 中提及.我們仍然將它們列在 devDependencies 中以供開發使用.

If your package uses some modules only for build, test, or bundles them into a dist file (i.e. what will be used by the consumer project), then those modules should not be mentioned in dependencies. We still list them in devDependencies for development.

現在對于電子應用程序,您將應用程序作為消費者項目的節點模塊使用的可能性很小,因此上述約定并不真正相關.

Now in the case of an electron app, there is little chance you will consume your app as a node module of a consumer project, therefore the above convention is not really relevant.

此外,我們還遇到了 electron 包被捆綁為構建輸出的一部分的情況.您的用戶無需從 npm 獲取 electron 即可使用您構建的應用程序.因此它很好地匹配了 devDependency 的定義.

Furthermore, we fall in the case where the electron package is bundled as part of the built output. There is no need for your user to get electron from npm to use your built app. Therefore it matches well the definition of a devDependency.

話雖如此,IIRC 一些電子打包程序將您的 dependencies 捆綁到構建的應用程序中,因此您仍然需要嚴格地填寫此列表.

That being said, IIRC some electron packagers bundle your dependencies into the built app, so you still need some rigour in filling this list.

這篇關于為什么 Electron 需要保存為開發者依賴?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How to fix BrowserWindow is not a constructor error when creating child window in Electron renderer process(在 Electron 渲染器進程中創建子窗口時如何修復 BrowserWindow 不是構造函數錯誤) - IT屋-程序員軟件開發技術
mainWindow.loadURL(quot;https://localhost:3000/quot;) show white screen on Electron app(mainWindow.loadURL(https://localhost:3000/) 在 Electron 應用程序上顯示白屏)
Electron webContents executeJavaScript : Cannot execute script on second on loadURL(Electron webContents executeJavaScript:無法在第二個 loadURL 上執行腳本)
how to use electron browser window inside components in angular-cli?(如何在angular-cli的組件內使用電子瀏覽器窗口?)
ElectronJS - sharing redux store between windows?(ElectronJS - 在 Windows 之間共享 redux 存儲?)
How to access camera/webcamera inside electron app?(如何在電子應用程序中訪問相機/網絡攝像頭?)
主站蜘蛛池模板: 久久久久久久久久久蜜桃 | 在线视频一区二区 | av乱码| 国产激情第一页 | 欧美三级电影在线播放 | 精品真实国产乱文在线 | 国产9999精品 | 精品伊人| 福利在线看 | 精品91av| 亚洲成人毛片 | 伊人网站在线 | 欧美精品久久久久久久久久 | 四虎影院美女 | 欧美一级在线 | 欧美日韩一区二区三区视频 | 一级a爱片久久毛片 | 久久成人免费视频 | 国产精品久久国产精品 | 亚洲h在线观看 | 中文字幕免费中文 | 久热免费在线 | 亚洲视频在线观看 | 日韩一级免费电影 | 日韩精品一区二区三区免费视频 | 亚洲综合一区二区三区 | 99热最新 | 爱爱综合网| a久久 | 成人亚洲 | 国产高清一二三区 | 中文字幕精品一区二区三区在线 | 91网站在线观看视频 | 在线毛片网 | 国产一区二区黑人欧美xxxx | 亚洲一区二区电影在线观看 | 亚洲av一级毛片 | 国产91久久久久久 | 国产在线麻豆精品入口 | 一区日韩 | 综合网中文字幕 |