Not able to use created build.lib using Vite.JS in other projects

Viewed 750

(Link which I referred to create a library build)

Now how should I use this library build in some other project, I have created and uploaded the lib build as an npm package .

What should I add to view the library components in new Project after npm i

Steps Done

  1. - Package.json for library creation project
  "main": "./dist/reporting-ui-component.umd.js",
  "module": "./dist/reporting-ui-component.es.js",
  "exports": {
    ".": {
      "import": "./dist/reporting-ui-component.es.js",
      "require": "./dist/reporting-ui-component.umd.js"
    }
  },
  1. Output for the above library build

| dist
|--- reporting-ui-component.es.js
|--- reporting-ui-component.umd.js

  1. Created a npm package an published it as an artifactory with name - @reporting-ui-component

  2. Now I am planning to install the library in other project, but it gives an error

Error [plugin: vite:dep-scan] Failed to resolve entry for package "@reporting-ui-component". The package may have incorrect main/module/exports specified in its package.json.

Need solution on how to import this package and start working ?

0 Answers
Related