Using Webpack, Babel, React and deploy it to Heroku

This may just be a simple question, but I can’t find a satisfying answer from Google & Co

On 31st of January I finished the API-Projects from the Back End Certificate and I totally liked working with Github, deploying everything to Heroku and seeing the Apps live.
So I thought I could start transfering my Markdown-Previewer and Camper-Leaderboard - which I created on Codepen - to Github & Heroku, splitting up React-Components into seperate files and so on and so on.

After reading through various documentations, tutorials, watching Youtube-videos I slowly started to get a grasp on server-side-rendering, client-side-rendering, universal Javascript and much more stuff I never ever thought about.
After completing this tutorial I started to transfer my previous React-Projects.
Markdown-Previewer: Github-Repo, Live App
Camper-Leaderboard: Github-Repo, Live App

I mean, it’s working like I wanted it to do and after all I feel quite confident now using Babel, Webpack & Co.
But I really can’t find an answer to this question - maybe with some explanation :sweat_smile:
Do I have to push (and deploy) my compiled Javascript-Code from my lib-directory, created with Babel, and my bundle.js and bundle.css created with Webpack directly to Github OR should I continue with this:

  • I include the lib-directory and also the bundle.js and bundle.css files in .gitignore and
  • I compile with babel and bundle with webpack on npm start, and run the compiled `server.js
    • I use the following scripts inside my package.json:
      "build-js": "babel src -d lib --presets=es2015,react", "start": "npm run build-js && webpack -p && node lib/server.js",
1 Like

But since npm package policy is too volatile, I would make sure that all dependencies are shrinkwrapped before pushing, or use yarn.

1 Like