Home > Mobile >  npm publish only publish index.js and excluding everything else
npm publish only publish index.js and excluding everything else

Time:03-09

Problems

I'm trying to publish my own SDK in npm. When I'm trying to install my packages, my dist folder only shows index.js

Code:

Here is my package.json file. It already includes main and files, https://docs.npmjs.com/cli/v8/using-npm/scripts.

{
  "version": "0.1.4",
  "license": "MIT",
  "main": "dist/index.js",
  "typings": "dist/index.d.ts",
  "files": [
    "dist"
  ],
  "engines": {
    "node": ">=10"
  },
  "scripts": {
    "start": "tsdx watch",
    "build": "tsdx build",
    "test": "tsdx test --passWithNoTests",
    "lint": "tsdx lint",
    "prepare": "tsdx build",
    "prepublish": "tsdx build",
    "size": "size-limit",
    "analyze": "size-limit --why"
  },
  "peerDependencies": {
    "react": ">=16"
  },
  "husky": {
    "hooks": {
      "pre-commit": "tsdx lint"
    }
  },
  "name": "@grammable/sdk",
  "author": "peanut butter jelly",
  "homepage": "https://github.com/grammable/grammable-sdk",
  "repository": "https://github.com/grammable/grammable-sdk",
  "publishConfig": {
    "access": "public"
  },
  "module": "dist/grammable.esm.js",
  "size-limit": [
    {
      "path": "dist/grammable.cjs.production.min.js",
      "limit": "10 KB"
    },
    {
      "path": "dist/grammable.esm.js",
      "limit": "10 KB"
    }
  ],
}

I removed my devDependencies and dependencies to remove unnecessary lines. Can someone help me?

This is my folder structure. folder

Update: I have tried using npx npm-packlist. It has everything I need, but when I npm publish it, it only builds index.js

Edit 2:

npm notice            
  • Related