简体   繁体   English

什么是 npm init 中的“入口点”

[英]What is "entry point" in npm init

I have an empty new project, when i run npm init i got a list of questions to answer, for example:我有一个空的新项目,当我运行 npm init 时,我得到了一个要回答的问题列表,例如:

name: (karma)
version: (1.0.0)
description:my project description
entry point: (index.js)

I am really confused about the one that says "entry point", Should this be my index.html file or my app.js or is it something else?我真的很困惑那个说“入口点”的东西,这应该是我的 index.html 文件还是我的 app.js 还是别的什么?

Quoting from this blog post :引用此博客文章

Entry point is the javascript file that will be invoked when consumers of your module “require” it, this file will include the main logic for your module, or if it is a large module you can export public functions found with other files (typically in the lib directory)入口点是当你的模块的消费者“需要”它时将调用的 javascript 文件,这个文件将包含你的模块的主要逻辑,或者如果它是一个大模块,你可以导出与其他文件一起找到的公共函数(通常在lib目录)

So it should be your app.js file.所以它应该是你的app.js文件。

For any project, entry point is the file from which execution starts.对于任何项目,入口点是开始执行的文件。 It depends on project configuration and run time environment of the technology we are using.这取决于我们使用的技术的项目配置和运行时环境。

Examples : For a node.js project app.js is used initializes the app and glues everything together.示例:对于 node.js 项目app.js用于初始化应用程序并将所有内容粘合在一起。

入口点是您的用户将使用 index.js 访问的路径,以便能够访问您模块的完整视图和服务,如果您不知道自己在做什么,我宁愿保持原样。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM