chialab / rna

πŸš€ Build tools for modern web modules and applications.
https://chialab.github.io/rna/
MIT License
171 stars 21 forks source link

Error with `require-resolve` #159

Closed kurtextrem closed 10 months ago

kurtextrem commented 10 months ago

Hi! πŸ‘‹

Firstly, thanks for your work on this project! πŸ™‚

Today I used patch-package to patch @chialab/esbuild-plugin-require-resolve@0.17.2 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/@chialab/esbuild-plugin-require-resolve/lib/index.js b/node_modules/@chialab/esbuild-plugin-require-resolve/lib/index.js
index d719d3b..c5ad87e 100644
--- a/node_modules/@chialab/esbuild-plugin-require-resolve/lib/index.js
+++ b/node_modules/@chialab/esbuild-plugin-require-resolve/lib/index.js
@@ -56,6 +56,7 @@ export default function() {
                         const { path: resolvedFilePath } = await build.resolve(fileName, {
                             importer: args.path,
                             resolveDir: path.dirname(args.path),
+                            kind: 'require-resolve',
                         });
                         if (!resolvedFilePath) {
                             return;

This issue body was partially generated by patch-package.

edoardocavazza commented 10 months ago

Hello @kurtextrem, thanks for the report. Would you like to try the 0.18.0-alpha.1 release? We should have fixed this in the upcoming 0.18 release

kurtextrem commented 10 months ago

Thank you!