1

there is another unfortunately named post that appears to be asking the same question, but is, in fact, not. this is actually asking how to do what I asked specifically.

I have a situation where we can't use NPM. not being as familiar with JS as I'd like to be, I want to use the vueDataTables library, but don't know how (or if) I can bypass the NPM-only install instructions and just download, link, and use it locally.

more generally, how would one use an NPM installed library when you don't have or can't use NPM and need to link the library locally?

WhiteRau
  • 818
  • 14
  • 32
  • Why not just use https://datatables.net/? As the vue-data-table stated in their README, it was their inspiration. Also, I think you can't use vue-data-table without Vue..js? – jdoroy Mar 17 '20 at 02:12
  • uh... you got me there. wasn't aware of this resource. we do use VueJS and jQuery locally, so I was pointed to the other by a co-worker. while this might solve the specific issue, I am still curious about using NPM libraries in general in environs without NPM. – WhiteRau Mar 17 '20 at 02:21
  • Since a UMD build isn't available, I think your only option is to follow @ Dvid Silva's answer. – jdoroy Mar 17 '20 at 02:52

1 Answers1

1

You can download the zip build file, and add it to your source code, then you can import it using the local path. For example

  import DataTables from './lib/vuewthing/dist.js

Or add the source files from that library and point to them, but that will slow down your build times and performance.

If they don't have a downloadble build, you can clone it, and build it, and then paste the built files to your source.

Dvid Silva
  • 1,110
  • 13
  • 25
  • forgive my frontend ignorance, by 'clone it, and build it', to what are you referring? – WhiteRau Mar 17 '20 at 02:14
  • like the action of git clone, and then running whatever build command they have. because when you clone or download the source code it might not be in a usable state., https://www.atlassian.com/git/tutorials/setting-up-a-repository/git-clone and the build process is `npm run build` as you can see in the scripts section of package.json – Dvid Silva Mar 18 '20 at 14:20