简体   繁体   中英

Gulp I need /dist to have node_modules and .git

I have folder structure like this

  • dist
  • src
    • public
      • index.html
      • main.js
    • server
      • server.js
  • package.json
  • Procfile
  • .env
  • .gitignore
  • .git
  • gulpfile.js
  • node_modules

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 ?

Hoping this explanation will help you:

The /dist folder would be self-sufficient if you have a npm script to build your project to the dist folder and then the npm script start to run your application from this folder.

Another thing, the node_modules and the dist folder shouldn't go to any repository, since they're obtained from npm scripts (npm install and npm run build, in sequence).

Furthermore, as mentioned in their documentation, the "dependencies" part of package.json must include all the necessary packages to build your application

Why's that so?

"After running the installation and build steps Heroku will strip out the packages declared under devDependencies before deploying the application." - Heroku Team

If you have any other question, reply here...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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