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

Can't import the library because of wrong "main" entry in package.json #70

Closed
CapsE opened this issue Oct 5, 2023 · 6 comments
Closed

Comments

@CapsE
Copy link

CapsE commented Oct 5, 2023

Hi, you have an error in your package.json

{
  "name": "nice-select2",
  "version": "2.1.0",
  "description": "A lightweight Vanilla JavaScript plugin that replaces native select elements with customizable dropdowns.",
  "main": "src/js/nice-select.js",
  "directories": {
    "doc": "docs"
  }
  ...

You're pointing to src/js/nice-select.js but the file is acutally named nice-select2.js this leads to issue when I try to import the library using webpack.

@kodie
Copy link
Contributor

kodie commented Oct 12, 2023

Fixed 964cbee

@remderk
Copy link

remderk commented Jan 16, 2024

The problem persists when installing via npm

@jamesfawcett
Copy link

This issue is still in the latest release 2.1.0 in both this Github repo releases, and npm @CapsE

@bdube30
Copy link

bdube30 commented Mar 1, 2024

Anyone know if there a way to fix this ? I use vitejs and I got this error : "Failed to resolve entry for package "nice-select2". The package may have incorrect main/module/exports specified in its package.json."

I'm pretty sure it the same kind of issue,

I would really like to use nice-select2 for my project.

Thanks.

@dougblackjr
Copy link

dougblackjr commented Mar 22, 2024

For all looking, while we wait for this to be updated in NPM, here's how I solved this on my end:

  1. Install patch-package: npm i patch-package. There are a few other steps here, found this great article.
  2. In node_modules/nice-select2/package.json, apply the changes in the commit above
  3. Run npx patch-package nice-select2 --exclude 'nothing'
  4. Run npm install
  5. Save your changes to git if so inclined.

@Tsjippy
Copy link
Collaborator

Tsjippy commented Apr 16, 2024

fixed in version 2.2.0

@Tsjippy Tsjippy closed this as completed Apr 16, 2024
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

No branches or pull requests

7 participants