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

Error while loading package with Vite #31

Closed
LeviSTA opened this issue May 24, 2023 · 3 comments
Closed

Error while loading package with Vite #31

LeviSTA opened this issue May 24, 2023 · 3 comments

Comments

@LeviSTA
Copy link

LeviSTA commented May 24, 2023

We're trying to import the package and build it with vite but get this error:

Error:   Failed to scan for dependencies from entries: 
  C:/apps/sta-bimviewer/bim-viewer/index.html

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


    node_modules/esbuild/lib/main.js:1360:21:
      1360 │         let result = await callback({
           ╵                      ^

    at packageEntryFailure (file:///C:/apps/sta-bimviewer/bim-viewer/node_modules/vite/dist/node/chunks/dep-a178814b.js:23384:11)
    at resolvePackageEntry (file:///C:/apps/sta-bimviewer/bim-viewer/node_modules/vite/dist/node/chunks/dep-a178814b.js:23381:5)
    at tryNodeResolve (file:///C:/apps/sta-bimviewer/bim-viewer/node_modules/vite/dist/node/chunks/dep-a178814b.js:23115:20)
    at Context.resolveId (file:///C:/apps/sta-bimviewer/bim-viewer/node_modules/vite/dist/node/chunks/dep-a178814b.js:22

                                                                                                                       2876:28)
    at Object.resolveId (file:///C:/apps/sta-bimviewer/bim-viewer/node_modules/vite/dist/node/chunks/dep-a178814b.js:428
                                                                                                                       805:46)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async resolve (file:///C:/apps/sta-bimviewer/bim-viewer/node_modules/vite/dist/node/chunks/dep-a178814b.js:43104:
                                                                                                                       :26)
    at async file:///C:/apps/sta-bimviewer/bim-viewer/node_modules/vite/dist/node/chunks/dep-a178814b.js:43278:34       
    at async requestCallbacks.on-resolve (C:\apps\sta-bimviewer\bim-viewer\node_modules\esbuild\lib\main.js:1360:22)    
    at async handleRequest (C:\apps\sta-bimviewer\bim-viewer\node_modules\esbuild\lib\main.js:723:13)

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

    node_modules/esbuild/lib/main.js:1279:20:
      1279 │       let promise = setup({
           ╵                     ^

    at setup (file:///C:/apps/sta-bimviewer/bim-viewer/node_modules/vite/dist/node/chunks/dep-a178814b.js:43268:19)     
    at handlePlugins (C:\apps\sta-bimviewer\bim-viewer\node_modules\esbuild\lib\main.js:1279:21)
    at buildOrContextImpl (C:\apps\sta-bimviewer\bim-viewer\node_modules\esbuild\lib\main.js:968:5)
    at Object.buildOrContext (C:\apps\sta-bimviewer\bim-viewer\node_modules\esbuild\lib\main.js:776:5)
    at C:\apps\sta-bimviewer\bim-viewer\node_modules\esbuild\lib\main.js:2172:68
    at new Promise (<anonymous>)
    at Object.context (C:\apps\sta-bimviewer\bim-viewer\node_modules\esbuild\lib\main.js:2172:27)
    at Object.context (C:\apps\sta-bimviewer\bim-viewer\node_modules\esbuild\lib\main.js:2012:58)
    at prepareEsbuildScanner (file:///C:/apps/sta-bimviewer/bim-viewer/node_modules/vite/dist/node/chunks/dep-a178814b.j
                                                                                                                       js:43055:26)

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

    src/managers/IfcManager.ts:8:75:
      8 │ ...roup, Fragments, PostproductionRenderer} from "openbim-components";
        ╵                                                  ~~~~~~~~~~~~~~~~~~~~


    at failureErrorWithLog (C:\apps\sta-bimviewer\bim-viewer\node_modules\esbuild\lib\main.js:1636:15)
    at C:\apps\sta-bimviewer\bim-viewer\node_modules\esbuild\lib\main.js:1048:25
    at runOnEndCallbacks (C:\apps\sta-bimviewer\bim-viewer\node_modules\esbuild\lib\main.js:1471:45)
    at buildResponseToResult (C:\apps\sta-bimviewer\bim-viewer\node_modules\esbuild\lib\main.js:1046:7)
    at C:\apps\sta-bimviewer\bim-viewer\node_modules\esbuild\lib\main.js:1058:9
    at new Promise (<anonymous>)
    at requestCallbacks.on-end (C:\apps\sta-bimviewer\bim-viewer\node_modules\esbuild\lib\main.js:1057:54)
    at handleRequest (C:\apps\sta-bimviewer\bim-viewer\node_modules\esbuild\lib\main.js:723:19)
    at handleIncomingPacket (C:\apps\sta-bimviewer\bim-viewer\node_modules\esbuild\lib\main.js:745:7)
    at Socket.readFromStdout (C:\apps\sta-bimviewer\bim-viewer\node_modules\esbuild\lib\main.js:673:7)
Failed to resolve entry for package "openbim-components". The package may have incorrect main/module/exports specified in its package.json.
@LeviSTA
Copy link
Author

LeviSTA commented May 25, 2023

Managed to fix it by doing this: "openbim-components/index" in the import instead of this: "openbim-components"

@LeviSTA LeviSTA closed this as completed May 25, 2023
@LeviSTA
Copy link
Author

LeviSTA commented May 25, 2023

It doesn't work as you have this in your package.json: "main": "dist/index.js", while there is not dist folder.

@agviegas
Copy link
Contributor

Thanks for the notice, I will fix this!

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

2 participants