Wrote a plug-in, how to package it for others to modularize the introduction?

for example, write a pop-up plug-in. After I send this package to npm, how can I get someone else to import my package and introduce my plug-in? what should I do?

Mar.24,2021

    After
  1. is published to npm, someone else npm install-- save your package will download all the source code of this package (except those you have ignored in configuration) to node_modules , and then successfully locate to the index.js given in this directory in the project.
  2. The rule introduced by
  3. modularization is to find a index.js file in which export anything can be introduced in the form of import anything from 'package name' , so the published package provides a index.js and allows others to introduce this index.js .
  4. when it comes to dependencies, pay attention to the location and version in package.json . Note the compilation rule configuration in tsconfig.json of ts .
Menu