I don't think this is completely impossible, it's overall JavaScript, why now? :D
But do notice that node.js is a runtime environment that uses JavaScript as its language. There are certainly packages using its core modules, and I bet it's going to be hard as some of the packages are targeting only to node environment.
Some of the packages such as jQuery, moment.js are capable working on both client and server version, some even provide 2 different versions, one for client, one for server,
so you can definitely do npm install jquery
and include them from your node_modules
folder like how you would normally include your script.
You could also take a look at these,
PS: If they have a client-side, it could also be available on Bower, the "client-side" npm.
PS2: If you would like to "require" libraries like you do on node, you could try to use AMD RequireJS as well. It provides similar syntax as CommonJS
if you're using npm packages on views better switch to bower because npm is not made for inclusion on views. It will work on some but some packages will not work like that.
so i have to use bower and install extra js libraries like require etc?
i will have a look on bower website. thanks!
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community