# Deploy ionic 4 to WEB application

**URL:** <https://forum.ionicframework.com/t/deploy-ionic-4-to-web-application/141309>\
**Category:** Ionic Framework\
**Created:** [September 10, 2018, 3:47pm UTC](https://forum.ionicframework.com/t/deploy-ionic-4-to-web-application/141309 "2018-09-10T15:47:12Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![yns23](https://avatars.discourse-cdn.com/v4/letter/y/74df32/32.png) [@yns23](https://forum.ionicframework.com/u/yns23)\
**Post date:** [September 10, 2018, 3:47pm UTC](https://forum.ionicframework.com/t/deploy-ionic-4-to-web-application/141309/1 "2018-09-10T15:47:12Z")

</div>

hello

i want to create a web application , i try what is in the documentation , many youtube tutorials and many articles too  
but i can’t deploy my application … i try my code with angular , it works fine

any help please

---

<div class="post-metadata">

**Author:** ![yns23](https://avatars.discourse-cdn.com/v4/letter/y/74df32/32.png) [@yns23](https://forum.ionicframework.com/u/yns23)\
**Post date:** [September 13, 2018, 4:20am UTC](https://forum.ionicframework.com/t/deploy-ionic-4-to-web-application/141309/2 "2018-09-13T04:20:43Z")

</div>

No one want to give me some help

---

<div class="post-metadata">

**Author:** ![hirenkorat3](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/hirenkorat3/32/128872_2.png) [@hirenkorat3](https://forum.ionicframework.com/u/hirenkorat3)\
**Post date:** [September 13, 2018, 5:20am UTC](https://forum.ionicframework.com/t/deploy-ionic-4-to-web-application/141309/3 "2018-09-13T05:20:09Z")

</div>

if you want to deploy ionic application as web app then just put `www` folder in your serve it will works

---

<div class="post-metadata">

**Author:** ![salomon022](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@salomon022](https://forum.ionicframework.com/u/salomon022)\
**Post date:** [September 13, 2018, 5:33am UTC](https://forum.ionicframework.com/t/deploy-ionic-4-to-web-application/141309/4 "2018-09-13T05:33:02Z")

</div>

> ionic cordova platform add browser  
> ionic cordova build browser

check : platforms/ browser/index.htm

---

<div class="post-metadata">

**Author:** ![firmino](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/firmino/32/68704_2.png) [@firmino](https://forum.ionicframework.com/u/firmino)\
**Post date:** [September 13, 2018, 6:29pm UTC](https://forum.ionicframework.com/t/deploy-ionic-4-to-web-application/141309/5 "2018-09-13T18:29:09Z")

</div>

Like a Angular application, add the service worker is as simple as running the following command in your existing Ionic 4 project:

```auto
ng add @angular/pwa --project yourApp

```

If you take a look at the **ngsw-config.json** file, you will see something like this:

```auto
{
  "index": "/index.html",
  "assetGroups": [{
    "name": "app",
    "installMode": "prefetch",
    "resources": {
      "files": [
        "/favicon.ico",
        "/index.html",
        "/*.css",
        "/*.js"
      ]
    }
  }, {
    "name": "assets",
    "installMode": "lazy",
    "updateMode": "prefetch",
    "resources": {
      "files": [
        "/assets/**"
      ]
    }
  }]
}

```

If you take a look at the **app.module.ts** file, you will see the following new import:

```auto
imports: [
  ...
  ServiceWorkerModule.register('/ngsw-worker.js', { enabled: environment.production })
],

```

To create a production build of your Ionic PWA, you can just run the following command: `ionic build --prod`

This will run the build process, and output the result to your **www** folder. The contents of this folder is your completed PWA.

---

<div class="post-metadata">

**Author:** ![danieldugger](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@danieldugger](https://forum.ionicframework.com/u/danieldugger)\
**Post date:** [September 13, 2018, 6:40pm UTC](https://forum.ionicframework.com/t/deploy-ionic-4-to-web-application/141309/6 "2018-09-13T18:40:54Z")

</div>

What web server are you using to host your Ionic project?

Also, you do not need to make use of Cordova in order for you to host your project on a web server.

Is your project hosted at the root level?

I ran into an issue with the base href tag within the index.html file. I have read that all is required is setting it to . However, I took the approach of specifying each directory, \<base href="/CheckInApp/"

You will also want to ensure that your manifest.json is updated to reflect the change in the base href.

If you are hosting this project within IIS, you will have to write a URL rewrite rule.

I suggest checking the Deployment section of Angular’s website as it provides further documentation of what I wrote above

---

<div class="post-metadata">

**Author:** ![yns23](https://avatars.discourse-cdn.com/v4/letter/y/74df32/32.png) [@yns23](https://forum.ionicframework.com/u/yns23)\
**Post date:** [October 5, 2018, 11:12am UTC](https://forum.ionicframework.com/t/deploy-ionic-4-to-web-application/141309/7 "2018-10-05T11:12:37Z")

</div>

Thanks 4 you all … I’m grateful to have a community like you … Great thanks

---

<div class="post-metadata">

**Author:** ![NurGuz](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/nurguz/32/111671_2.png) [@NurGuz](https://forum.ionicframework.com/u/NurGuz)\
**Post date:** [February 5, 2019, 12:57pm UTC](https://forum.ionicframework.com/t/deploy-ionic-4-to-web-application/141309/8 "2019-02-05T12:57:19Z")

</div>

> [@danieldugger](#):
>

What are u doing to delay the app? And, where u deploy? IIS?

thaks!

---

<div class="post-metadata">

**Author:** ![danieldugger](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@danieldugger](https://forum.ionicframework.com/u/danieldugger)\
**Post date:** [February 6, 2019, 10:57pm UTC](https://forum.ionicframework.com/t/deploy-ionic-4-to-web-application/141309/9 "2019-02-06T22:57:51Z")

</div>

Hey:

With a 3.x project, I use **npm run ionic:build – --prod**  
With a 4.x project, I use **ionic build --prod**

I do host mine within IIS. You will want to reference the Deployment Section of Angular’s documentation as it will discuss URL Rewrites, which you will need for a 4.x project. You’ll also want to pay attention to the Base Href within index.html and the scope and start\_url section of the manifest.json file in order for it to work once added to the Home Screen.

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:17pm UTC](https://forum.ionicframework.com/t/deploy-ionic-4-to-web-application/141309/10 "2021-07-19T21:17:40Z")

</div>

Closed on July 19, 2021, 9:17pm UTC


