Skip to content

bug: Ionicons are not loaded in browser when ionic build --prod was given (V4) #18614

Closed

Description

@Gowrisankar23

I created an ionic app using CLI. and served the app using ionic serve, it worked perfectly. I tried to take browser build using ionic build --prod and run the index.html in www folder.

The app was ran successfully but the icons are not displaying. I checked the network tab and therelated svg are loaded correctly.

But in Android devices, icons are loaded perfectly.

ionic V 4.1.0

Activity

  1. liamdebeasi commented on Jun 25, 2019

    @liamdebeasi
    Contributor

    Hi there,

    Thanks for the issue. Can you provide the output of running ionic info in your project's directory?

    Thanks!

  2. Gowrisankar23 commented on Jun 25, 2019

    @Gowrisankar23
    Author

    Thanks for the replay.

    `Ionic:

    Ionic CLI : 5.0.0 (C:\Users\Anandhang\AppData\Roaming\npm\node_modules\ionic)
    Ionic Framework : @ionic/angular 4.5.0
    @angular-devkit/build-angular : 0.13.9
    @angular-devkit/schematics : 7.3.9
    @angular/cli : 7.3.9
    @ionic/angular-toolkit : 1.5.1

    Cordova:

    Cordova CLI : 9.0.0 (cordova-lib@9.0.1)
    Cordova Platforms : browser 6.0.0
    Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.1.0, (and 4 other plugins)

    Utility:

    cordova-res : not installed
    native-run : 0.2.2

    System:

    NodeJS : v10.15.0 (C:\Program Files\nodejs\node.exe)
    npm : 6.4.1
    OS : Windows 10`

  3. added and removed
    needs: replythe issue needs a response from the user
    on Jun 25, 2019
  4. liamdebeasi commented on Jun 26, 2019

    @liamdebeasi
    Contributor

    Thanks for the follow up. When doing ionic build --prod and using routing, you can't open index.html using its file path. you will need to serve it up using a server (even if it's just a local server).

    Can you serve your app using a server and let me know if you are still running into issues? If you have python installed, you can run a local server on your computer using python -m SimpleHTTPServer 8000.

    Thanks!

  5. Snickdx commented on Jul 18, 2019

    @Snickdx

    Issue still persists for me. Even on conference starter app with updated ionic angular. Served using live-server npm package

    Ionic Info
    Ionic:

    Ionic CLI : 5.2.2 (C:\Users\snick\AppData\Roaming\npm\node_modules\ionic)
    Ionic Framework : @ionic/angular 4.6.2
    @angular-devkit/build-angular : 0.13.9
    @angular-devkit/schematics : 7.3.9
    @angular/cli : 7.3.9
    @ionic/angular-toolkit : 1.5.1

    Cordova:

    Cordova CLI : not installed
    Cordova Platforms : not available
    Cordova Plugins : not available

    Utility:

    cordova-res : not installed
    native-run : not installed

    System:

    NodeJS : v10.15.3 (C:\Program Files\nodejs\node.exe)
    npm : 6.9.0
    OS : Windows 10

  6. Gowrisankar23 commented on Jul 18, 2019

    @Gowrisankar23
    Author

    Hi Liam,

    I ran the build (dist) folder live-server library. Still its not working for me.

    Thanks.

  7. liamdebeasi commented on Jul 18, 2019

    @liamdebeasi
    Contributor

    Thanks for the follow up. Are you able to reproduce this with an Ionic starter app?

  8. Gowrisankar23 commented on Jul 18, 2019

    @Gowrisankar23
    Author

    Yes. It's repeated in starter app also.

  9. added and removed
    needs: replythe issue needs a response from the user
    on Jul 18, 2019
  10. liamdebeasi commented on Jul 19, 2019

    @liamdebeasi
    Contributor

    Thanks for the follow up. I was able to reproduce this using the live-server package.

    What appears to be happening is in order for live-server to work properly with svg elements, it injects some JavaScript into the svg element.

    The Ionicons component strips anything inside of the svg element that is not svg related material. Allowing JavaScript to be freely injected into our components would pose a security risk to our users, so we remove it.

    Additionally, there seem to be some issues with using svgs in live-server in general: tapio/live-server#272.

    As an alternative, you can use python -m SimpleHTTPServer [PORT] if you need a simple server without live reloading. If you do need a server with live reloading, I would recommend you use your framework's solution for live reloading (for example, if building with Angular try using ng serve).

    I am going to close this as this is not an Ionic issue. I would recommend filing a bug on the live-server GitHub repo. Thanks!

  11. Snickdx commented on Jul 20, 2019

    @Snickdx

    Confirming error is on live-server's end. Works as expected on firebase hosting.

  12. ionitron-bot commented on Aug 19, 2019

    @ionitron-bot

    Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

  13. locked and limited conversation to collaborators on Aug 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions