clearairturbulence
clearairturbulence

Reputation: 165

How to use module source from NPM in my website?

If I install a module via npm, what is the proper way to use the code in my website? I mean simply making node_modules static seems ridiculous, but I can't figure out how to easily create a static folder with the few pieces of JS I want to use in it.

Of course there are symbolic links and a lot of hacks I can think of off the top of my head, but I was just curious if there is a known workflow/way to solve this problem that I simply haven't read about yet.

Upvotes: 2

Views: 42

Answers (2)

Quentin
Quentin

Reputation: 943564

Browserify and Webpack are the tools usually chosen to bundle up modules managed through npm for deployment to be used client side.

Upvotes: 3

martriay
martriay

Reputation: 5742

You want webpack

webpack supports pre-processing files via loaders. This allows you to bundle any static resource not only javascript. You can easily write your own loaders running in node.js.

Upvotes: 1

Related Questions