evanw / esbuild

An extremely fast bundler for the web
https://esbuild.github.io/
MIT License
38.19k stars 1.15k forks source link

False report native module #2148

Closed yovanoc closed 2 years ago

yovanoc commented 2 years ago
image

I think its a false report for the .node files ?

evanw commented 2 years ago

It looks like the problem is that the plugin native-node-modules didn't set a resolve directory for the file node-file:/Users/devchris/code/nodejs/adonis/adonis/node_modules/@jsdevtools/ono/esm/isomorphic.node.js. This is a problem with the plugin. Documentation is here: https://esbuild.github.io/plugins/#on-load-results. I have copied the relevant part of the documentation here for you below:

  • resolveDir

    This is the file system directory to use when resolving an import path in this module to a real path on the file system. For modules in the file namespace, this value defaults to the directory part of the module path. Otherwise this value defaults to empty unless the plugin provides one. If the plugin doesn't provide one, esbuild's default behavior won't resolve any imports in this module. This directory will be passed to any on-resolve callbacks that run on unresolved import paths in this module.

The part that says "If the plugin doesn't provide one, esbuild's default behavior won't resolve any imports in this module" is why this is happening.

I'm closing this issue as invalid because the error message is correct.

yovanoc commented 2 years ago

The fact is that is not a native module? Maybe I’m missing something but I think the plugin take it because of the ‘.node’ part in the name but is just a simple js file

evanw commented 2 years ago

You have added a plugin called native-node-modules to your build configuration. That's a name that you picked; esbuild didn't pick that name. There's nothing anywhere in esbuild's code base with that string: https://github.com/evanw/esbuild/search?q=%22native-node-modules%22. Furthermore there's no logic in esbuild's code base to special-case file names containing .node in the middle. That's not something esbuild does.

yovanoc commented 2 years ago

Oh yes it was not me but tsup. I will look this way, sorry for bothering.