entegra
entegra

Reputation: 305

Confused about which Vuejs files to push to NPM for a library

I am on windows, using Vuejs trying to build my own library and push to NPM.

These are my working environments:

$ node -v
v10.16.0

$ npm -v
6.9.0

$ vue -V
3.8.4

I followed cli.vuejs.org/guide/build-targets.html page to build my library, and finally after running:

vue-cli-service build --target lib --name myLib ./src/index.js  

I can see the output just like in here or here from my output:

You may use special comments to disable some warnings.
Use // eslint-disable-next-line to ignore the next line.
Use /* eslint-disable */ to ignore all warnings in a file.
File                           Size                  Gzipped

dist\my-vue-lib.umd.min.js    28.90 KiB             10.02 KiB
dist\my-vue-lib.umd.js        81.10 KiB             20.21 KiB
dist\my-vue-lib.common.js     80.71 KiB             20.09 KiB

Images and other types of assets omitted.

The thing I don't understand is, when I push my package to NPM, do I only push these files? Or do I push the whole root of my directory (without node_modules)

Some things are not clear or mentioned in the docs, or maybe they are assumed everyone knows. But after the build process is success, do I push my entire folder to NPM?

Just to be clear, when I initialized the project I used the command

vue create my-vue-lib

and it generated everything from readme, package.json, tests/ ... I asked this because before the new vue-cli the process was different.

So to sum it up, after the build process is success, what do I push to NPM?

Upvotes: 2

Views: 208

Answers (1)

Michael
Michael

Reputation: 5038

Just push your dist, the rest is not needed. Create a .npmignore put in your ./src** that should be ok.

Upvotes: 2

Related Questions