lucacasonato / esbuild_deno_loader

Deno module resolution for `esbuild`
https://deno.land/x/esbuild_deno_loader
MIT License
160 stars 43 forks source link

Could not resolve react in "@react-three/drei" using deno-loader #124

Open nestarz opened 5 months ago

nestarz commented 5 months ago

Description

I encountered an error while using the deno-loader plugin in my Deno project. The error message indicates that it could not resolve the "react" module only when using @react-three/drei. It's doing fine with @react-three/fiber.

Error Message

✘ [ERROR] Could not resolve "react" [plugin deno-loader]
    ../../../Library/Caches/deno/deno_esbuild/tunnel-rat@0.1.2_react@18.2.0/node_modules/tunnel-rat/dist/index.js:1:18:
      1 │ import React from 'react';
        ╵                   ~~~~~~~
...
error: Uncaught (in promise) Error: Build failed with 3 errors:
../../../Library/Caches/deno/deno_esbuild/@react-three/drei@9.105.2_@react-three+fiber@8.16.1__react@18.2.0__three@0.163.0_react@18.2.0_three@0.163.0/node_modules/@react-three/drei/web/Html.js:3:26: ERROR: [plugin: deno-loader] Could not resolve "react-dom/client"
../../../Library/Caches/deno/deno_esbuild/@react-three/drei@9.105.2_@react-three+fiber@8.16.1__react@18.2.0__three@0.163.0_react@18.2.0_three@0.163.0/node_modules/@react-three/drei/web/ScrollControls.js:3:26: ERROR: [plugin: deno-loader] Could not resolve "react-dom/client"
../../../Library/Caches/deno/deno_esbuild/tunnel-rat@0.1.2_react@18.2.0/node_modules/tunnel-rat/dist/index.js:1:18: ERROR: [plugin: deno-loader] 

Steps to Reproduce

  1. Install the deno-loader plugin in a Deno project.
  2. Attempt to import the "@react-three/drei" module using esbuild and the deno-loader in a JavaScript or TypeScript file.
  3. Run the Deno script.

Expected Behavior

The deno-loader plugin should be able to resolve the "react" module and allow its usage in the Deno project.

Actual Behavior

The deno-loader plugin fails to resolve the "react" module, resulting in the aforementioned error.

Environment

Additional Information

Possible Cause

It seems that the deno-loader plugin is unable to resolve the "react" module correctly, possibly due to a configuration issue or a compatibility problem between the plugin and the "react" module.

I would appreciate any assistance or guidance in resolving this issue. Please let me know if you need any further information or clarification.

Thank you for your attention to this matter.

twosaturdayscode commented 2 months ago

Hey! Try give a look at my comment on a similar issue: https://github.com/lucacasonato/esbuild_deno_loader/issues/127#issuecomment-2211477464