PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, July 13, 2022

[FIXED] Why are node modules working on firebase emulator but not working post deployment?

 July 13, 2022     firebase, firebase-hosting, intl-tel-input, node-modules, web-deployment     No comments   

Issue

I am using intl-tel-input in my project which I installed using npm. Every thing seems to work fine when I test using Firebase emulators but it stops working post deployment.

Upon checking the Sources tab in Chrome dev tools, I can see that the module is not properly included. (Pls check images) However, I am completely unable to figure out why. Please help!

Emulator Screenshot with the Telephone Input field working fine.

Screenshot taken post deployment with the Telephone input field broken.

Source File - intlTelInput.js located at /node_modules/intl-tel-input/build/css/intlTelInput.js

Source File - intlTelInput.css located at /node_modules/intl-tel-input/build/js/intlTelInput.css


Solution

By default Firebase ignores node_modules directories when deploying.

There are a few options you could use to resolve this.

  1. Use a build tool like Rollup or Webpack to generate bundles that include node dependencies.
  2. Copy required node_modules files to a different directory like assets and load them from there.
  3. Update firebase.json to not ignore node_modules on deploy. Note that this will probably greatly increase the size of deployed applications if you have any number of node packages.


Answered By - abraham
Answer Checked By - Gilberto Lyons (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing