You can import the needed packages in the app.js file.
import { whatYouNeed } from 'package'
I'm currently in the middle of developing a project. Lately, I found myself having the need to hookup some npm packages on my system. But I have been lucky with finding composer packages instead.
But I think its better to learn how to implement these npm packages myself because I will surely need some of them in the future.
I've tried searching from time to time how to fix this specific error Uncaught ReferenceError: require is not defined that I'm getting but I can't find an answer that works for me.
I don't really work with JS that much, I only use them for very basic stuff. So, I think I need to properly understand how this works.
So basically, I'm trying to install a package then on the guide it requires me to do this:
const zipcodes = require('zipcodes-ph');
then I need to link the js file like this <script src="path/to/zipcodes-ph/build/index.umd.min.js"></script> so this file is located in a folder in the node_modules directory.
With composer its easy because we just need to composer install then publish some files then we can use it right away I'm not really sure with what I'm doing with these npm packages.
I'm not really getting anything by searching or I'm just looking at the wrong place, so your help will pretty much be appreciated, thanks!
Please or to participate in this conversation.