+ 1
JS • can you use “require” in vanilla JS or is it for backend only?
I want to know if the require is usable in front end to import the whole JS file - instead of using import.
1 Réponse
+ 1
require is used to import Nodejs files only, you can also use import in place of require and vice-versa but only one at a time in whole application by altering type key in package.json
Note: you have to use only one in whole application both can not be simultaneously used.
And in front-end i haven't ever used require but i guess we can configure it to that if we want but it isn't industry standard.