cd test2 && ls -a
# . README.md index.html public vite.config.js
# .. assets package.json src
期望结果
生成的lite模板含有.gitignore
文件
实际结果
模板没有.gitignore
文件。.gitignore文件非常重要,没有此文件可能导致不注意时上传了node_modules或者其他文件。
框架版本
No response
浏览器版本
No response
系统版本
No response
Node版本
16.20.0
补充说明
根据npm官网文档,.gitignore
文件会被忽略发布,需要特殊配置
原文信息:
Files included in package
To see what will be included in your package, run npm pack --dry-run. All files are included by default, with the following exceptions:
Certain files that are relevant to package installation and distribution are always included. For example, package.json, README.md, LICENSE, and so on.
If there is a "files" list in package.json, then only the files specified will be included. (If directories are specified, then they will be walked recursively and their contents included, subject to the same ignore rules.)
If there is a .gitignore or .npmignore file, then ignored files in that and all child directories will be excluded from the package. If both files exist, then the .gitignore is ignored, and only the .npmignore is used.
.npmignore files follow the same pattern rules as .gitignore files
If the file matches certain patterns, then it will never be included, unless explicitly added to the "files" list in package.json, or un-ignored with a ! rule in a .npmignore or .gitignore file.
Symbolic links are never included in npm packages.
See developers for full details on what's included in the published package, as well as details on how the package is built.