Nativescript - 主文件夹和应用文件夹中的 package.json 有什么区别?
Nativescript - what's the difference between the package.json in the main and the app folder?
应用程序文件夹中似乎有一个 package.json 文件。
那和根文件夹里的有什么区别?
好问题。
我没注意到第二个app/package.json
项目明智的唯一重要 package.json 应该是根。
除非 nativescript 对 app/package.json 做了一些潜在的魔法,那个文件似乎被他们用来生成应用程序文件夹的一些 git 存储库继承,看起来像。
但这只是猜测,我不是框架内部专家。
引用原帖here
The package.json at the root is used to define
the dependencies of the template, to persist some project specific
information, etc.
The package.json in the app folder is coming from
the template. It has several purposes:
- it allows us to have the templates published in npm.
- it defines the
dependencies and devDependencies required to use the template -
nativescript-cli copies them to root's package.json during creation.
- most important - this package.json is copied to native project and it
defines the entry point of the application (`"main": "main.js"). At
runtime this value is read and application is started from this point.
应用程序文件夹中似乎有一个 package.json 文件。
那和根文件夹里的有什么区别?
好问题。 我没注意到第二个app/package.json
项目明智的唯一重要 package.json 应该是根。 除非 nativescript 对 app/package.json 做了一些潜在的魔法,那个文件似乎被他们用来生成应用程序文件夹的一些 git 存储库继承,看起来像。
但这只是猜测,我不是框架内部专家。
引用原帖here
The package.json at the root is used to define the dependencies of the template, to persist some project specific information, etc.
The package.json in the app folder is coming from the template. It has several purposes:
- it allows us to have the templates published in npm.
- it defines the dependencies and devDependencies required to use the template - nativescript-cli copies them to root's package.json during creation.
- most important - this package.json is copied to native project and it defines the entry point of the application (`"main": "main.js"). At runtime this value is read and application is started from this point.