'How to deploy our app which is running on parcel bundler

In my recent project, I have made an animated website using gsap and parcel-bundler. When I want to run it, I will type parcel index.html or npm run dev and it will start a server on port 1234, making it accessible at http://localhost:1234/.

Can anyone tell me how to deploy it to netlify or Heroku?

My package.json file looks like this

{
   "name":"expportfolio",
   "version":"1.0.0",
   "description":"",
   "main":"app.js",
   "scripts":{
      "dev":"parcel index.html",
      "build":"parcel build index.html"
   },
   "author":"",
   "license":"ISC",
   "devDependencies":{
      "cssnano":"^4.1.10",
      "sass":"^1.26.7"
   },
   "dependencies":{
      "@dogstudio/highway":"^2.2.1",
      "gsap":"^3.3.0"
   }
}

Terminal: Terminal Screenshot

Web: Web Screenshot



Solution 1:[1]

There must be a command in parcel that will build your project. You can upload your project to netlify and then add this command to its Build Settings console and it'll use that command to build your application. You can define a lot of other stuff there too.

If this project is on github, you can just add your github account to netlify and directly transfer it over there.

ref: https://docs.netlify.com/configure-builds/get-started/#basic-build-settings

Solution 2:[2]

Try this command from the docs: parcel build index.html

Solution 3:[3]

just use this command on the terminal on your project file: npx parcel build src/index.html. where src is the folder where index.html is and you will get a build on dist folder. Directly deploy it on netlify or any other platform easily.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Danyal
Solution 2 Double Marvellous
Solution 3 Madhur