{"id":722,"date":"2022-04-02T18:48:00","date_gmt":"2022-04-02T18:48:00","guid":{"rendered":"http:\/\/shabeebk.com\/blog\/?p=722"},"modified":"2022-04-02T18:28:11","modified_gmt":"2022-04-02T18:28:11","slug":"create-and-publish-your-first-vue-js-library-to-npm","status":"publish","type":"post","link":"http:\/\/shabeebk.com\/blog\/create-and-publish-your-first-vue-js-library-to-npm\/","title":{"rendered":"Create &#038; Publish your first Vue.js library to npm: part 2"},"content":{"rendered":"\n<p>As we work along with the javascript framework (vue \/ react) we will realize that there are custom components in our application that you might need to re-use in different applications or sometimes we have to share with the community.<\/p>\n\n\n\n<p>Let&#8217;s see how to publish our first component into npm and use it in our project.<\/p>\n\n\n\n<p>In my previous post, I explain how to create a vuejs plugin and use it in our project. In this post I am going to use the same project to publish in npm<\/p>\n\n\n\n<p>please refer to my <a href=\"http:\/\/shabeebk.com\/blog\/build-a-vue-js-component-library-and-push-to-npm\/\" target=\"_blank\" rel=\"noreferrer noopener\">previous post here<\/a>  if you miss it <\/p>\n\n\n\n<h2><strong>Configuring Package.json<\/strong><\/h2>\n\n\n\n<p>In the last blog, I explain how to create and use the library\/plugin. Lets recap important things to do before publishing into npm <\/p>\n\n\n\n<p>After we build library\/plugin files into <code>dist<\/code>  folder, we have to update our <code>package.json <\/code><\/p>\n\n\n\n<p>Let us add the main entry point in packge.json file<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\"main\": \".\/dist\/lib.umd.min.js\",<\/code><\/pre>\n\n\n\n<p>Now let&#8217;s whitelist what are the files needed when someone is using them inside their <code>node_modules<\/code>. Here we need to include only <code>dist<\/code>  folder from our project.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\"files\": &#91; \"dist\/*\"],<\/code><\/pre>\n\n\n\n<p>Pushing compiled source code is the right way to publish in NPM. Users usually won&#8217;t edit this code. if they want to make changes, they can fork from version control systems (like Github).<br>In case you want to include all files, we add like below<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\"files\": &#91;\n  \"dist\/*\",\n  \"src\/*\", \n  \"folder\/*\",\n],<\/code><\/pre>\n\n\n\n<p>Let&#8217;s add additional details like author details and license also into the package.json<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"name\": \"sb-vue-component-library\",\n  \"version\": \"0.1.0\",\n  \"private\": false,\n  \"license\": \"MIT\",\n  \"author\": { \n    \"name\" : \"Shabeeb K\",\n    \"email\" : \"mail@shabeebk.com\",\n    \"url\" : \"http:\/\/shabeebk.com\/\"\n  },\n  \"main\": \".\/dist\/lib.umd.min.js\",\n  \"files\": &#91; \"dist\/*\"],\n  \"scripts\": {\n    \"serve\": \"vue-cli-service serve\",\n    \"build\": \"vue-cli-service build\",\n    \"lint\": \"vue-cli-service lint\",\n    \"build:lib\": \"vue-cli-service build --name lib --target lib --dest dist src\/lib-setup.js\"\n  },\n  \"dependencies\": {\n    \"core-js\": \"^3.8.3\",\n    \"vue\": \"^2.6.14\"\n  },\n  \"devDependencies\": {\n    \"@babel\/core\": \"^7.12.16\",\n    \"@babel\/eslint-parser\": \"^7.12.16\",\n    \"@vue\/cli-plugin-babel\": \"~5.0.0\",\n    \"@vue\/cli-plugin-eslint\": \"~5.0.0\",\n    \"@vue\/cli-service\": \"~5.0.0\",\n    \"eslint\": \"^7.32.0\",\n    \"eslint-plugin-vue\": \"^8.0.3\",\n    \"vue-template-compiler\": \"^2.6.14\"\n  },\n  \"peerDependencies\": {\n    \"vue\": \"^2.6.14\"\n  }\n}\n<\/code><\/pre>\n\n\n\n<p>What are these fields if you wonder<\/p>\n\n\n\n<ul><li>name: Name of the component<\/li><li>version: the version number of our plugin\/library. You will have to increment this number every time you publish an update for your package. usually we follow <a href=\"https:\/\/docs.npmjs.com\/about-semantic-versioning\" target=\"_blank\" rel=\"noreferrer noopener\">semantic versioning <\/a><\/li><li><code>private<\/code> : This means your package is public (i.e. everyone is able to see and install it).<\/li><li>license: license for our package<\/li><li>author: author details<\/li><li>main: \u00a0The primary entry point to our plugin.<\/li><li>files: specifies which files should be published on NPM.<\/li><\/ul>\n\n\n\n<p>For more details please refer <a href=\"https:\/\/docs.npmjs.com\/cli\/v7\/configuring-npm\/package-json\" target=\"_blank\" rel=\"noreferrer noopener\">npmjs<\/a><\/p>\n\n\n\n<h2>Add license file <\/h2>\n\n\n\n<p>In GitHub, it&#8217;s easy to add a license, If you are using MIT license,  <\/p>\n\n\n\n<p>Click on add file in GitHub and name it as <code>License.md<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.11.19-PM.png\"><img loading=\"lazy\" width=\"1024\" height=\"116\" src=\"http:\/\/shabeebk.com\/blog\/wp-content\/plugins\/jquery-image-lazy-loading\/images\/grey.gif\" data-original=\"http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.11.19-PM.png\" alt=\"\" class=\"lazy wp-image-726\" srcset=\"http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.11.19-PM.png 1024w, http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.11.19-PM-300x34.png 300w, http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.11.19-PM-768x87.png 768w, http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.11.19-PM-788x89.png 788w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><noscript><img loading=\"lazy\" width=\"1024\" height=\"116\" src=\"http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.11.19-PM.png\" alt=\"\" class=\"wp-image-726\" srcset=\"http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.11.19-PM.png 1024w, http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.11.19-PM-300x34.png 300w, http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.11.19-PM-768x87.png 768w, http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.11.19-PM-788x89.png 788w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/noscript><\/a><\/figure>\n\n\n\n<p>Then we can see choose from the template. Here i am using \u00a0MIT license\u00a0<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.08.03-PM.png\"><img loading=\"lazy\" width=\"1024\" height=\"183\" src=\"http:\/\/shabeebk.com\/blog\/wp-content\/plugins\/jquery-image-lazy-loading\/images\/grey.gif\" data-original=\"http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.08.03-PM.png\" alt=\"\" class=\"lazy wp-image-727\" srcset=\"http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.08.03-PM.png 1024w, http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.08.03-PM-300x54.png 300w, http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.08.03-PM-768x137.png 768w, http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.08.03-PM-788x141.png 788w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><noscript><img loading=\"lazy\" width=\"1024\" height=\"183\" src=\"http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.08.03-PM.png\" alt=\"\" class=\"wp-image-727\" srcset=\"http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.08.03-PM.png 1024w, http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.08.03-PM-300x54.png 300w, http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.08.03-PM-768x137.png 768w, http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.08.03-PM-788x141.png 788w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/noscript><\/a><\/figure>\n\n\n\n<p>Commit changes to Github.<\/p>\n\n\n\n<h2> Publish to npm <\/h2>\n\n\n\n<p>If you don&#8217;t have an account in <a href=\"http:\/\/npmjs.com\" target=\"_blank\" rel=\"noreferrer noopener\">npmjs.com<\/a>. create one.<\/p>\n\n\n\n<p>Lets login from the command line <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>npm login<\/code><\/pre>\n\n\n\n<p>This will ask you to enter the user name and password of the npm account. (TFA if you enable it ).<\/p>\n\n\n\n<p>once login it will show message <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Logged in as username on https:\/\/registry.npmjs.org\/.<\/code><\/pre>\n\n\n\n<p>Let us do a build <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> npm run build:lib<\/code><\/pre>\n\n\n\n<p>now we can publish to npm <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>npm publish<\/code><\/pre>\n\n\n\n<p>I faced some issue since my component name is already existing in vue, so I updated component name <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.19.52-PM.png\"><img loading=\"lazy\" width=\"1024\" height=\"708\" src=\"http:\/\/shabeebk.com\/blog\/wp-content\/plugins\/jquery-image-lazy-loading\/images\/grey.gif\" data-original=\"http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.19.52-PM.png\" alt=\"\" class=\"lazy wp-image-729\" srcset=\"http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.19.52-PM.png 1024w, http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.19.52-PM-300x207.png 300w, http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.19.52-PM-768x531.png 768w, http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.19.52-PM-788x545.png 788w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><noscript><img loading=\"lazy\" width=\"1024\" height=\"708\" src=\"http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.19.52-PM.png\" alt=\"\" class=\"wp-image-729\" srcset=\"http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.19.52-PM.png 1024w, http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.19.52-PM-300x207.png 300w, http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.19.52-PM-768x531.png 768w, http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.19.52-PM-788x545.png 788w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/noscript><\/a><\/figure>\n\n\n\n<p>It will appear in npmjs immediately <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.21.17-PM.png\"><img loading=\"lazy\" width=\"1024\" height=\"297\" src=\"http:\/\/shabeebk.com\/blog\/wp-content\/plugins\/jquery-image-lazy-loading\/images\/grey.gif\" data-original=\"http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.21.17-PM.png\" alt=\"\" class=\"lazy wp-image-730\" srcset=\"http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.21.17-PM.png 1024w, http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.21.17-PM-300x87.png 300w, http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.21.17-PM-768x223.png 768w, http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.21.17-PM-788x229.png 788w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><noscript><img loading=\"lazy\" width=\"1024\" height=\"297\" src=\"http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.21.17-PM.png\" alt=\"\" class=\"wp-image-730\" srcset=\"http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.21.17-PM.png 1024w, http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.21.17-PM-300x87.png 300w, http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.21.17-PM-768x223.png 768w, http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.21.17-PM-788x229.png 788w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/noscript><\/a><\/figure>\n\n\n\n<p>Yey, we did it :). Now anyone can use this package in their project<\/p>\n\n\n\n<h2>Using package <\/h2>\n\n\n\n<p>To use package in the project <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>npm install --save sb-vue-component-library<\/code><\/pre>\n\n\n\n<p>To use it globally , in main.js<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import myButton from \"sb-vue-component-library\";\nVue.use(myButton);<\/code><\/pre>\n\n\n\n<p>To use it inside a component,<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import myButton from \"sb-vue-component-library\";<\/code><\/pre>\n\n\n\n<p>Thats it, Now we publish our component into npm and use it in different project<\/p>\n\n\n\n<p><\/p>\n<div class=\"pvc_clear\"><\/div><p class=\"pvc_stats all \" data-element-id=\"722\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> &nbsp;2,053&nbsp;total views, &nbsp;1&nbsp;views today<\/p><div class=\"pvc_clear\"><\/div>","protected":false},"excerpt":{"rendered":"<p>As we work along with the javascript framework (vue \/ react) we will realize that there are custom components in our application that you might need to re-use in different applications or sometimes we have to share with the community. Let&#8217;s see how to publish our first component into npm and use it in our [&hellip;]<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p class=\"pvc_stats all \" data-element-id=\"722\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> &nbsp;2,053&nbsp;total views, &nbsp;1&nbsp;views today<\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":""},"categories":[1,62,79],"tags":[68,88,89,87,69,56,72,83,82,64,66],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v18.4.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Create &amp; Publish your first Vue.js library to npm: part 2 - shabeeb Blog<\/title>\n<meta name=\"description\" content=\"In this tutorial, we can learn how to create a npm package and publish to npm. Here I am creating a simple vue plugin and publish to npm\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/shabeebk.com\/blog\/create-and-publish-your-first-vue-js-library-to-npm\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Create &amp; Publish your first Vue.js library to npm: part 2 - shabeeb Blog\" \/>\n<meta property=\"og:description\" content=\"In this tutorial, we can learn how to create a npm package and publish to npm. Here I am creating a simple vue plugin and publish to npm\" \/>\n<meta property=\"og:url\" content=\"http:\/\/shabeebk.com\/blog\/create-and-publish-your-first-vue-js-library-to-npm\/\" \/>\n<meta property=\"og:site_name\" content=\"shabeeb Blog\" \/>\n<meta property=\"article:published_time\" content=\"2022-04-02T18:48:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-04-02T18:28:11+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.11.19-PM.png\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"shabeeb\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"http:\/\/shabeebk.com\/blog\/#website\",\"url\":\"http:\/\/shabeebk.com\/blog\/\",\"name\":\"shabeeb Blog\",\"description\":\"A developer blog\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/shabeebk.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"http:\/\/shabeebk.com\/blog\/create-and-publish-your-first-vue-js-library-to-npm\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.11.19-PM.png\",\"contentUrl\":\"http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.11.19-PM.png\",\"width\":1024,\"height\":116},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/shabeebk.com\/blog\/create-and-publish-your-first-vue-js-library-to-npm\/#webpage\",\"url\":\"http:\/\/shabeebk.com\/blog\/create-and-publish-your-first-vue-js-library-to-npm\/\",\"name\":\"Create & Publish your first Vue.js library to npm: part 2 - shabeeb Blog\",\"isPartOf\":{\"@id\":\"http:\/\/shabeebk.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"http:\/\/shabeebk.com\/blog\/create-and-publish-your-first-vue-js-library-to-npm\/#primaryimage\"},\"datePublished\":\"2022-04-02T18:48:00+00:00\",\"dateModified\":\"2022-04-02T18:28:11+00:00\",\"author\":{\"@id\":\"http:\/\/shabeebk.com\/blog\/#\/schema\/person\/71832abe654179971635c65c09bceb29\"},\"description\":\"In this tutorial, we can learn how to create a npm package and publish to npm. Here I am creating a simple vue plugin and publish to npm\",\"breadcrumb\":{\"@id\":\"http:\/\/shabeebk.com\/blog\/create-and-publish-your-first-vue-js-library-to-npm\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/shabeebk.com\/blog\/create-and-publish-your-first-vue-js-library-to-npm\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/shabeebk.com\/blog\/create-and-publish-your-first-vue-js-library-to-npm\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/shabeebk.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Create &#038; Publish your first Vue.js library to npm: part 2\"}]},{\"@type\":\"Person\",\"@id\":\"http:\/\/shabeebk.com\/blog\/#\/schema\/person\/71832abe654179971635c65c09bceb29\",\"name\":\"shabeeb\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"http:\/\/shabeebk.com\/blog\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"http:\/\/0.gravatar.com\/avatar\/9998389cc76a77663881c48f7d4cbba0?s=96&d=mm&r=g\",\"contentUrl\":\"http:\/\/0.gravatar.com\/avatar\/9998389cc76a77663881c48f7d4cbba0?s=96&d=mm&r=g\",\"caption\":\"shabeeb\"},\"description\":\"Developer,Entrepreneur, software engineer more than that a human being\",\"sameAs\":[\"http:\/\/shabeebk.com\/blog\"],\"url\":\"http:\/\/shabeebk.com\/blog\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Create & Publish your first Vue.js library to npm: part 2 - shabeeb Blog","description":"In this tutorial, we can learn how to create a npm package and publish to npm. Here I am creating a simple vue plugin and publish to npm","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/shabeebk.com\/blog\/create-and-publish-your-first-vue-js-library-to-npm\/","og_locale":"en_US","og_type":"article","og_title":"Create & Publish your first Vue.js library to npm: part 2 - shabeeb Blog","og_description":"In this tutorial, we can learn how to create a npm package and publish to npm. Here I am creating a simple vue plugin and publish to npm","og_url":"http:\/\/shabeebk.com\/blog\/create-and-publish-your-first-vue-js-library-to-npm\/","og_site_name":"shabeeb Blog","article_published_time":"2022-04-02T18:48:00+00:00","article_modified_time":"2022-04-02T18:28:11+00:00","og_image":[{"url":"http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.11.19-PM.png"}],"twitter_misc":{"Written by":"shabeeb","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"http:\/\/shabeebk.com\/blog\/#website","url":"http:\/\/shabeebk.com\/blog\/","name":"shabeeb Blog","description":"A developer blog","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/shabeebk.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"ImageObject","@id":"http:\/\/shabeebk.com\/blog\/create-and-publish-your-first-vue-js-library-to-npm\/#primaryimage","inLanguage":"en-US","url":"http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.11.19-PM.png","contentUrl":"http:\/\/shabeebk.com\/blog\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-02-at-6.11.19-PM.png","width":1024,"height":116},{"@type":"WebPage","@id":"http:\/\/shabeebk.com\/blog\/create-and-publish-your-first-vue-js-library-to-npm\/#webpage","url":"http:\/\/shabeebk.com\/blog\/create-and-publish-your-first-vue-js-library-to-npm\/","name":"Create & Publish your first Vue.js library to npm: part 2 - shabeeb Blog","isPartOf":{"@id":"http:\/\/shabeebk.com\/blog\/#website"},"primaryImageOfPage":{"@id":"http:\/\/shabeebk.com\/blog\/create-and-publish-your-first-vue-js-library-to-npm\/#primaryimage"},"datePublished":"2022-04-02T18:48:00+00:00","dateModified":"2022-04-02T18:28:11+00:00","author":{"@id":"http:\/\/shabeebk.com\/blog\/#\/schema\/person\/71832abe654179971635c65c09bceb29"},"description":"In this tutorial, we can learn how to create a npm package and publish to npm. Here I am creating a simple vue plugin and publish to npm","breadcrumb":{"@id":"http:\/\/shabeebk.com\/blog\/create-and-publish-your-first-vue-js-library-to-npm\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/shabeebk.com\/blog\/create-and-publish-your-first-vue-js-library-to-npm\/"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/shabeebk.com\/blog\/create-and-publish-your-first-vue-js-library-to-npm\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/shabeebk.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Create &#038; Publish your first Vue.js library to npm: part 2"}]},{"@type":"Person","@id":"http:\/\/shabeebk.com\/blog\/#\/schema\/person\/71832abe654179971635c65c09bceb29","name":"shabeeb","image":{"@type":"ImageObject","@id":"http:\/\/shabeebk.com\/blog\/#personlogo","inLanguage":"en-US","url":"http:\/\/0.gravatar.com\/avatar\/9998389cc76a77663881c48f7d4cbba0?s=96&d=mm&r=g","contentUrl":"http:\/\/0.gravatar.com\/avatar\/9998389cc76a77663881c48f7d4cbba0?s=96&d=mm&r=g","caption":"shabeeb"},"description":"Developer,Entrepreneur, software engineer more than that a human being","sameAs":["http:\/\/shabeebk.com\/blog"],"url":"http:\/\/shabeebk.com\/blog\/author\/admin\/"}]}},"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/shabeebk.com\/blog\/wp-json\/wp\/v2\/posts\/722"}],"collection":[{"href":"http:\/\/shabeebk.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/shabeebk.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/shabeebk.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/shabeebk.com\/blog\/wp-json\/wp\/v2\/comments?post=722"}],"version-history":[{"count":4,"href":"http:\/\/shabeebk.com\/blog\/wp-json\/wp\/v2\/posts\/722\/revisions"}],"predecessor-version":[{"id":741,"href":"http:\/\/shabeebk.com\/blog\/wp-json\/wp\/v2\/posts\/722\/revisions\/741"}],"wp:attachment":[{"href":"http:\/\/shabeebk.com\/blog\/wp-json\/wp\/v2\/media?parent=722"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/shabeebk.com\/blog\/wp-json\/wp\/v2\/categories?post=722"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/shabeebk.com\/blog\/wp-json\/wp\/v2\/tags?post=722"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}