久久久久久久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?(如何在電子應用程序中訪問相機/網絡攝像頭?)
主站蜘蛛池模板: 午夜免费电影 | 久久国产欧美日韩精品 | 天堂精品 | 亚洲人在线播放 | 国产精品美女久久久久久免费 | 天堂成人国产精品一区 | 国产一区在线免费观看 | 国产精品污www一区二区三区 | 成人午夜影院 | 99re热精品视频 | 综合国产在线 | 欧美一区二区三区四区五区无卡码 | 亚洲图片视频一区 | 波多野结衣一区二区三区在线观看 | 欧美一级黄色片免费观看 | 中文字幕一区二区三区四区五区 | 91精品国产色综合久久不卡蜜臀 | 超碰8| 国产免费一区二区 | 久久精品亚洲欧美日韩久久 | 国产精品久久国产精品久久 | 亚洲美女av网站 | 一区二区三区视频在线免费观看 | 国产日韩欧美一区 | 妞干网视频 | 久久伊人精品 | 99久久久国产精品 | 毛片入口 | 中文字幕在线观看精品 | 国产激情视频网址 | 在线午夜| 成人在线小视频 | 91免费福利视频 | 国产传媒毛片精品视频第一次 | av免费网站在线 | 亚洲日韩中文字幕一区 | 特级黄一级播放 | 99精品国产一区二区三区 | 97精品超碰一区二区三区 | 一区二区三区四区在线 | 亚洲高清一区二区三区 |