LinbuduLab / esbuild-plugins

ESBuild plugins by @LinbuduLab
MIT License
113 stars 18 forks source link

esbuild-plugin-node-externals: could not resolve dependency #91

Closed xrzhuang closed 1 year ago

xrzhuang commented 1 year ago
npm ERR! Found: esbuild@0.15.12
npm ERR! node_modules/esbuild
npm ERR!   dev esbuild@"^0.15.11" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer esbuild@"^0.14.0" from esbuild-plugin-node-externals@0.3.0
npm ERR! node_modules/esbuild-plugin-node-externals
npm ERR!   dev esbuild-plugin-node-externals@"*" from the root project

same issue as https://github.com/LinbuduLab/nx-plugins/issues/88 will try a workaround in the meantimes

xrzhuang commented 1 year ago

another small thing with node-externals i would like to ask is if it's possible to only include the externals in specified output files

xrzhuang commented 1 year ago

i think im not correctly understanding the purpose of the plugin...

what im trying to do: im running some nodejs lambdas and i found using esbuild works great because it significantly reduces the size of the lambdas. however, because im bundling the dependencies, i have certain deps that aren't playing well with esbuild and are breaking, one of which is discordjs. my esbuild is creating taking each typescript file and bundling it up into a directory that produces index.js and index.js.map. what i want to do is for the bad dependency, copy it into the directory of the file, so in this case i want

node_modules
- @discordjs
discordmessage.ts

to become

dist
- discordmessage
-- index.js
-- index.js.map
-- node_modules
--- @discordjs

is this possible to accomplish with copy plugin? my build script will rm -rf the dist directory before it runs esbuild to create the new bundled files.

is there some other recommended way to workaround this issue? thank you any help would be appreciate @linbudu599