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

[Bug]: Failed to resolve entry for package "tsparticles" #3911

Closed
8 tasks done
netcore-jroger opened this issue Apr 15, 2022 · 1 comment · Fixed by #3912
Closed
8 tasks done

[Bug]: Failed to resolve entry for package "tsparticles" #3911

netcore-jroger opened this issue Apr 15, 2022 · 1 comment · Fixed by #3912
Assignees
Labels
bug Something isn't working triage

Comments

@netcore-jroger
Copy link

Contact Details

sjr_vip@126.com

What happened?

Describe the bug

After I use comand yarn add tsparticles tsparticles-engine react-tsparticles add these packages, I run yarn run dev command. than I got some exceptions.

✘ [ERROR] [plugin vite:dep-scan] Failed to resolve entry for package "tsparticles". The package may have incorrect main/module/exports specified in its package.json: Failed to resolve entry for package "tsparticles". The package may have incorrect main/module/exports specified in its package.json.

    node_modules/vite/dist/node/chunks/dep-27bc1ab8.js:38429:10:
      38429 │     throw new Error(`Failed to resolve entry for package "${id}". ` +
            ╵           ^

  This error came from the "onResolve" callback registered here:

    node_modules/vite/dist/node/chunks/dep-27bc1ab8.js:36968:18:
      36968 │             build.onResolve({
            ╵                   ~~~~~~~~~

other issue: vitejs/vite#7754

Reproduction

https://stackblitz.com/edit/vitejs-vite-iyeunl?file=package.json&terminal=dev

System Info

System:
    OS: Windows 10 10.0.22000
    Memory: 9.65 GB / 31.89 GB
  Binaries:
    Node: 14.18.2 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.18 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 8.3.0 - ~\AppData\Roaming\npm\npm.CMD
  Browsers:
    Chrome: 100.0.4896.127
    Edge: Spartan (44.22000.120.0), Chromium (100.0.1185.39)
  npmPackages:
    @vitejs/plugin-react-refresh: ^1.3.6 => 1.3.6
    vite: ^2.9.5 => 2.9.5

Used Package Manager

yarn

Logs

✘ [ERROR] [plugin vite:dep-scan] Failed to resolve entry for package "tsparticles". The package may have incorrect main/module/exports specified in its package.json: Failed to resolve entry for package "tsparticles". The package may have incorrect main/module/exports specified in its package.json.

    node_modules/vite/dist/node/chunks/dep-27bc1ab8.js:38429:10:
      38429 │     throw new Error(`Failed to resolve entry for package "${id}". ` +
            ╵           ^

    at packageEntryFailure (E:\demo\node_modules\vite\dist\node\chunks\dep-27bc1ab8.js:38429:11)
    at resolvePackageEntry (E:\demo\node_modules\vite\dist\node\chunks\dep-27bc1ab8.js:38425:9)
    at tryNodeResolve (E:\demo\node_modules\vite\dist\node\chunks\dep-27bc1ab8.js:38232:20)
    at Context.resolveId (E:\demo\node_modules\vite\dist\node\chunks\dep-27bc1ab8.js:38040:28)
    at Object.resolveId (E:\demo\node_modules\vite\dist\node\chunks\dep-27bc1ab8.js:36609:55)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async resolve (E:\demo\node_modules\vite\dist\node\chunks\dep-27bc1ab8.js:36821:26)
    at async E:\demo\node_modules\vite\dist\node\chunks\dep-27bc1ab8.js:36978:34
    at async callback (E:\demo\node_modules\esbuild\lib\main.js:921:28)
    at async handleRequest (E:\demo\node_modules\esbuild\lib\main.js:701:30)

  This error came from the "onResolve" callback registered here:

    node_modules/vite/dist/node/chunks/dep-27bc1ab8.js:36968:18:
      36968 │             build.onResolve({
            ╵                   ~~~~~~~~~

    at setup (E:\demo\node_modules\vite\dist\node\chunks\dep-27bc1ab8.js:36968:19)
    at handlePlugins (E:\demo\node_modules\esbuild\lib\main.js:843:23)
    at Object.buildOrServe (E:\demo\node_modules\esbuild\lib\main.js:1137:7)
    at E:\demo\node_modules\esbuild\lib\main.js:2079:17
    at new Promise (<anonymous>)
    at Object.build (E:\demo\node_modules\esbuild\lib\main.js:2078:14)
    at Object.build (E:\demo\node_modules\esbuild\lib\main.js:1927:51)
    at E:\demo\node_modules\vite\dist\node\chunks\dep-27bc1ab8.js:36769:54
    at Array.map (<anonymous>)

  The plugin "vite:dep-scan" was triggered by this import

    src/layout/login/index.tsx:12:25:
      12 │ import { loadFull } from "tsparticles";~~~~~~~~~~~~~

Build failed with 1 error:
node_modules/vite/dist/node/chunks/dep-27bc1ab8.js:38429:10: ERROR: [plugin: vite:dep-scan] Failed to resolve entry for package "tsparticles". The package may have incorrect main/module/exports specified in its package.json: Failed to resolve entry for package "tsparticles". The package may have incorrect main/module/exports specified in its package.json.

Validations

Version

2.0.5

Which library are you using?

React.js (react-tsparticles, react-particles-js)

tsParticles Configuration

{
  "backgroundMode": {
    "enable": true
  },
  "fpsLimit": 60,
  "particles": {
    "number": {
      "value": 0
    },
    "collisions": {
      "enable": false
    },
    "color": {
      "value": "#ffffff"
    },
    "shape": {
      "type": "circle"
    },
    "opacity": {
      "value": {
        "min": 0.3,
        "max": 0.8
      }
    },
    "size": {
      "value": {
        "min": 1,
        "max": 10
      }
    },
    "move": {
      "enable": true,
      "size": true,
      "speed": 5,
      "direction": "none",
      "outModes": {
        "default": "destroy"
      },
      "trail": {
        "enable": true,
        "fillColor": "#000000",
        "length": 3
      }
    }
  },
  "detectRetina": true,
  "background": {
    "color": "#000"
  },
  "emitters": {
    "direction": "none",
    "rate": {
      "delay": 0.25,
      "quantity": 10
    },
    "position": {
      "x": 50,
      "y": 50
    },
    "size": {
      "width": 0,
      "height": 0
    },
    "spawnColor": {
      "value": "#ff0000",
      "animation": {
        "h": {
          "enable": true,
          "speed": 5
        },
        "l": {
          "enable": true,
          "speed": 0,
          "offset": {
            "min": 20,
            "max": 80
          }
        }
      }
    }
  }
}

What browsers are you seeing the problem on?

Firefox

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@matteobruni
Copy link
Collaborator

Thanks @netcore-jroger, I've found the problem, there's a "module": "esm/index.js" that points to a non existing file, this will be fixed soon!

I need to check all build scripts (around 80 packages 😅) to see if there are similar cases

@matteobruni matteobruni mentioned this issue Apr 16, 2022
@matteobruni matteobruni linked a pull request Apr 16, 2022 that will close this issue
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants