Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WARNING: The following packages have a svelte field in their package.json but no exports condition for svelte. [email protected] #310

Closed
triadmoko opened this issue Dec 7, 2023 · 8 comments · Fixed by #313

Comments

@triadmoko
Copy link

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
Copy link
Owner

I will fix it in 4.0.0 tomorrow

@triadmoko
Copy link
Author

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

@craigcosmo
Copy link

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

@carbogninalberto
Copy link
Collaborator

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

@craigcosmo
Copy link

craigcosmo commented May 4, 2024

{
	"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
Copy link

userquin commented May 4, 2024

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
Copy link

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants