ItalyPaleAle / svelte-spa-router

Router for SPAs using Svelte 3
MIT License
1.53k stars 105 forks source link

WARNING: The following packages have a svelte field in their package.json but no exports condition for svelte. svelte-spa-router@3.3.0 #310

Closed triadmoko closed 9 months ago

triadmoko commented 9 months ago

Hi, I received a warning like the following, How do I resolve this warning?

image

file package.json

{
  "name": "app",
  "private": true,
  "version": "0.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "preview": "vite preview"
  },
  "devDependencies": {
    "@sveltejs/vite-plugin-svelte": "^3.0.0",
    "autoprefixer": "^10.4.16",
    "postcss": "^8.4.32",
    "svelte": "^4.2.3",
    "tailwindcss": "^3.3.6",
    "vite": "^5.0.0"
  },
  "dependencies": {
    "svelte-spa-router": "^3.3.0"
  }
}
ItalyPaleAle commented 9 months ago

I will fix it in 4.0.0 tomorrow

triadmoko commented 9 months ago

cool, I'm really excited to hear that, this working now, thank you

craigcosmo commented 4 months ago

how did you fix that? I got this warning on many packages

carbogninalberto commented 4 months ago

@craigcosmo can you please provide more details like the package.json?

craigcosmo commented 4 months ago
{
    "name": "sveltekit-barcode",
    "version": "2.0.2",
    "description": "A light-weight and high-performance component to generate barcode for Svelte.",
    "author": "Bunlong",
    "license": "MIT",
    "repository": {
        "type": "git",
        "url": "git+https://github.com/Bunlong/svelte-barcode.git"
    },
    "bugs": {
        "url": "https://github.com/Bunlong/svelte-barcode.git/issues"
    },
    "homepage": "https://github.com/Bunlong/svelte-barcode",
    "svelte": "src/index.js",
    "module": "dist/index.mjs",
    "main": "dist/index.js",
    "scripts": {
        "dev": "rollup -c -w",
        "build": "rollup -c",
        "prepublishOnly": "npm run build"
    },
    "devDependencies": {
        "@rollup/plugin-commonjs": "^18.0.0",
        "@rollup/plugin-node-resolve": "^9.0.0",
        "rollup": "^2.0.0",
        "rollup-plugin-svelte": "^6.0.0",
        "svelte": "^3.0.0"
    },
    "keywords": [
        "svelte",
        "svelte-barcode",
        "barcode"
    ],
    "files": [
        "src",
        "dist"
    ],
    "dependencies": {
        "jsbarcode": "^3.11.3"
    }
}
userquin commented 4 months ago

In this repo ./Router.svelte should be added to the package exports:

  "exports": {
    "./Router.svelte": {
      "types": "./Router.d.ts",
      "svelte": "./Router.svelte"
    },
    ".": {
      "types": "./Router.d.ts",
      "svelte": "./Router.svelte"
    }
  }
craigcosmo commented 4 months ago

I do that and publish, I got this error in my code

Cannot find module 'sveltekit-barcode' or its corresponding type declarations
CleanShot 2024-05-06 at 04 21 55
craigcosmo commented 4 months ago

I just create a new svelte kit library from npx create-app command and re-make the package from scratch, it works now.