0

This is a first time I am creating my npm package, when build the npm package, build folder is getting created but there is no index.js file in the build folder

As a result when I install this npm package to use, I am getting module not found error

Details of npm package is as below

package.json

{
  "name": "utils_personal",
  "version": "1.1.0",
  "type": "module",
  "description": "Useful utilities for working with  data. Isomorphic.",
  "main": "./build/index.js",
  "module": "./build/index.js",
  "types": "./build/index.d.ts",
  "exports": {
    ".": {
      "types": "./build/index.d.ts",
      "default": "./build/index.js"
    }
  },
  "sideEffects": false,
  "files": [
    "build"
  ],
  "engines": {
    "node": ">=12"
  },
  "scripts": {
    "build:tsc": "tsc --build",
    "test": "ava"
  },
  "author": "Asha",
  "license": "ISC",
  "dependencies": {
    "is-url-superb": "^6.1.0",
    "mem": "^9.0.2",
    "normalize-url": "^8.0.0",
    "notion_type_personal": "^1.1.0",
    "p-queue": "^7.3.4"
  },
  "devDependencies": {
    "ava": "^5.3.1",
    "tsup": "^7.1.0",
    "typescript": "^5.1.6"
  },
  "ava": {
    "snapshotDir": ".snapshots",
    "extensions": {
      "ts": "module"
    },
    "nodeArguments": [
      "--loader=ts-node/esm",
      "--no-warnings",
      "--experimental-specifier-resolution=node"
    ]
  }
}

tsconfig.json

{
  "extends": "./tsconfig.base",
  "compilerOptions": {
    "composite": true,
    "rootDir": "src",
    "outDir": "build",
    "tsBuildInfoFile": "build/.tsbuildinfo",
    "emitDeclarationOnly": true
  },
  "include": ["src"]
}

tsup.config.ts

import { defineConfig } from 'tsup'

export default defineConfig({
  entry: ['src/index.ts'],
  outDir: 'build',
  target: 'es2015',
  platform: 'browser',
  format: ['esm'],
  splitting: false,
  sourcemap: true,
  minify: true,
  shims: false
})

asha
  • 1

0 Answers0