Dictating how webpack resolves dependencies
I am building a project that uses webpack and babel to transpile user-submitted code. Im doing this in a serverless env using nextjs/vercel. Im running into issues where webpack is trying to resolve dependencies that it cant find because its running in a serverless env and is searching for them using my projects directory instead of the different directory thats built by next. Is there a way in my webpack config to specify where to start finding these deps using process.cwd() (what vercel suggests using instead of __dirname)?
This does seem like a odd question and I don't have a full understanding of whats actually going on here. Ive looked through webpacks docs and the webpack config types.d.ts file a ton trying to find a fix for this but have come up short
1 Reply
It looks like the code is erroring when i specify the webpack config like
const config = webpack({...})
. Why is nexts serverless function having trouble resolving this dep specificially when its installed correctly and being imported properly at the top of my route.ts file?
Also my code does work in a dedicated backend node env that I built with express
something about how next is building my route.ts function is breaking webpack