Gulp我需要/dist来拥有node_modules和.git

j9per5c4  于 2022-12-08  发布在  Gulp
关注(0)|答案(1)|浏览(199)

我有这样的文件夹结构

  • 距离
  • 源代码
  • 公开的
  • index.html
  • main.js
  • 伺服器
  • server.js
  • package.json
  • 过程文件
  • 文件
  • .忽略
  • . git文件
  • gulpfile.js
  • 节点模块

I need to upload /dist to Heroku and it requires git. And I need node_modules too in project. package.json on top includes express and socket.io depencencies and gulp as devDependencies. Should I upload whole thing to git and heroku or install just devDependencies in package.json on top and in /src create another package.json and node_modules and git and move it to /dist. I want /dist to be self-sufficient. But how ?

i7uq4tfw

i7uq4tfw1#

希望这个解释能对你有所帮助:
如果有一个npm脚本将项目构建到dist文件夹,然后有npm脚本start从该文件夹运行应用程序,则/dist文件夹将是独立的。
另外,node_modules和dist文件夹不应该转到任何存储库,因为它们是从npm脚本(npm install和npm run build,按顺序)获得的。
此外,正如他们的文档中提到的,package.json的“依赖关系”部分必须包括构建应用程序所需的所有包
"为什么会这样"

  • “运行安装和构建步骤后,Heroku将在部署应用程序之前剥离devDependencies下声明的包。"* - Heroku团队

如果您有任何其他问题,请在此回复...

相关问题