stackblogger / link-exists

A super lightweight JavaScript / TypeScript library to check whether a given url is valid and exists or not.
https://www.npmjs.com/package/link-exists
MIT License
1 stars 0 forks source link

Error with React vite. #1

Open LuisGhz opened 1 year ago

LuisGhz commented 1 year ago

I get the next error when import the library.

` Failed to resolve entry for package "http". The package may have incorrect main/module/exports specified in its package.json. [plugin vite:dep-pre-bundle]

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

at packageEntryFailure (file:///C:/Users/luisg/dev/react/my-unsplash-react/node_modules/vite/dist/node/chunks/dep-df561101.js:28691:11)
at resolvePackageEntry (file:///C:/Users/luisg/dev/react/my-unsplash-react/node_modules/vite/dist/node/chunks/dep-df561101.js:28688:5)
at tryNodeResolve (file:///C:/Users/luisg/dev/react/my-unsplash-react/node_modules/vite/dist/node/chunks/dep-df561101.js:28419:20)
at Context.resolveId (file:///C:/Users/luisg/dev/react/my-unsplash-react/node_modules/vite/dist/node/chunks/dep-df561101.js:28180:28)
at Object.resolveId (file:///C:/Users/luisg/dev/react/my-unsplash-react/node_modules/vite/dist/node/chunks/dep-df561101.js:44207:64)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async file:///C:/Users/luisg/dev/react/my-unsplash-react/node_modules/vite/dist/node/chunks/dep-df561101.js:65837:21
at async file:///C:/Users/luisg/dev/react/my-unsplash-react/node_modules/vite/dist/node/chunks/dep-df561101.js:39941:34
at async requestCallbacks.on-resolve (C:\Users\luisg\dev\react\my-unsplash-react\node_modules\esbuild\lib\main.js:1373:22)
at async handleRequest (C:\Users\luisg\dev\react\my-unsplash-react\node_modules\esbuild\lib\main.js:729:13)

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

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

at setup (file:///C:/Users/luisg/dev/react/my-unsplash-react/node_modules/vite/dist/node/chunks/dep-df561101.js:39921:19)
at handlePlugins (C:\Users\luisg\dev\react\my-unsplash-react\node_modules\esbuild\lib\main.js:1292:21)
at buildOrContextImpl (C:\Users\luisg\dev\react\my-unsplash-react\node_modules\esbuild\lib\main.js:978:5)
at Object.buildOrContext (C:\Users\luisg\dev\react\my-unsplash-react\node_modules\esbuild\lib\main.js:786:5)
at C:\Users\luisg\dev\react\my-unsplash-react\node_modules\esbuild\lib\main.js:2186:68
at new Promise (<anonymous>)
at Object.context (C:\Users\luisg\dev\react\my-unsplash-react\node_modules\esbuild\lib\main.js:2186:27)
at Object.context (C:\Users\luisg\dev\react\my-unsplash-react\node_modules\esbuild\lib\main.js:2026:58)
at prepareEsbuildOptimizerRun (file:///C:/Users/luisg/dev/react/my-unsplash-react/node_modules/vite/dist/node/chunks/dep-df561101.js:45967:35)

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

node_modules/link-exists/dist/index.esm.js:1:13:
  1 │ import t from"http";const o=/(http(s)?:\/\/.)?(www\....

`

B1ackg0d commented 10 months ago

I get the next error when import the library.

` Failed to resolve entry for package "http". The package may have incorrect main/module/exports specified in its package.json. [plugin vite:dep-pre-bundle]

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

at packageEntryFailure (file:///C:/Users/luisg/dev/react/my-unsplash-react/node_modules/vite/dist/node/chunks/dep-df561101.js:28691:11)
at resolvePackageEntry (file:///C:/Users/luisg/dev/react/my-unsplash-react/node_modules/vite/dist/node/chunks/dep-df561101.js:28688:5)
at tryNodeResolve (file:///C:/Users/luisg/dev/react/my-unsplash-react/node_modules/vite/dist/node/chunks/dep-df561101.js:28419:20)
at Context.resolveId (file:///C:/Users/luisg/dev/react/my-unsplash-react/node_modules/vite/dist/node/chunks/dep-df561101.js:28180:28)
at Object.resolveId (file:///C:/Users/luisg/dev/react/my-unsplash-react/node_modules/vite/dist/node/chunks/dep-df561101.js:44207:64)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async file:///C:/Users/luisg/dev/react/my-unsplash-react/node_modules/vite/dist/node/chunks/dep-df561101.js:65837:21
at async file:///C:/Users/luisg/dev/react/my-unsplash-react/node_modules/vite/dist/node/chunks/dep-df561101.js:39941:34
at async requestCallbacks.on-resolve (C:\Users\luisg\dev\react\my-unsplash-react\node_modules\esbuild\lib\main.js:1373:22)
at async handleRequest (C:\Users\luisg\dev\react\my-unsplash-react\node_modules\esbuild\lib\main.js:729:13)

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

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

at setup (file:///C:/Users/luisg/dev/react/my-unsplash-react/node_modules/vite/dist/node/chunks/dep-df561101.js:39921:19)
at handlePlugins (C:\Users\luisg\dev\react\my-unsplash-react\node_modules\esbuild\lib\main.js:1292:21)
at buildOrContextImpl (C:\Users\luisg\dev\react\my-unsplash-react\node_modules\esbuild\lib\main.js:978:5)
at Object.buildOrContext (C:\Users\luisg\dev\react\my-unsplash-react\node_modules\esbuild\lib\main.js:786:5)
at C:\Users\luisg\dev\react\my-unsplash-react\node_modules\esbuild\lib\main.js:2186:68
at new Promise (<anonymous>)
at Object.context (C:\Users\luisg\dev\react\my-unsplash-react\node_modules\esbuild\lib\main.js:2186:27)
at Object.context (C:\Users\luisg\dev\react\my-unsplash-react\node_modules\esbuild\lib\main.js:2026:58)
at prepareEsbuildOptimizerRun (file:///C:/Users/luisg/dev/react/my-unsplash-react/node_modules/vite/dist/node/chunks/dep-df561101.js:45967:35)

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

node_modules/link-exists/dist/index.esm.js:1:13:
  1 │ import t from"http";const o=/(http(s)?:\/\/.)?(www\....

`

Same problem.

stackblogger commented 9 months ago

Let me take a look into the issue and get back with a solution.