How do I get the only necessary js+css files into my wwwroot folder in Visual Studio 2022?

I am a web developer using .NET/C#/Razor Pages/Vanilla JS. I’m trying to integrate the npm packages in my Visual Studio 2022 workflow but failing to do so (or just think it is very complicated as I am not an expert on npm).

Here is what I have done so far in Visual Studio (besides reading countless tutorials and the guide):

npm install @uppy/core @uppy/dashboard

which creates a load of files in node_modules/@uppy. Now I have a list of source files in that folder. How do I take from here, i.e. how to get only the necessary files into my wwwroot folder without having to manually copy and picking the right js and css files every time a package is updated?
Preferably the necessary files go into a sub folder of wwwroot, such as wwwroot/lib/@uppy.

I guess what I am really asking is, what is the correct workflow?

PS:

  • I don’t use react, angular or similar. Just Vanilla JS.
  • I thought about using the CDN/jsdelivr version but 515kb of scripts is simply too much.

Hi, you are asking a very specific question regarding your tech stack, which doesn’t have anything to do with Uppy but with any package from npm. Therefor we can’t really help you, unless someone with .NET experience coincidentally finds this posts and is able to help.

For what it’s worth, here how GPT4 things you should do it:
https://chat.openai.com/share/e55ed221-f825-40f0-945f-2f8f33abc085

Thanks for the response.
I was not aware this was a wrong forum for such questions / I suppose this is not related to the .NET tech stack only but also relevant for others developing web applications using other stacks… isn’t the whole point to help people getting started with Uppy?

The GPT response is helpful but does not really solve the problem unfortunately. GPT suggests to copy from the /dist folders of both node_modules/ sub directories but the /dist folders for Uppy only contain css files and no js files. Some files are found in /lib folders but what to choose?
Furthermore, manual copy is involved there. I set up a gulpfile.js but that’s not really helpful if the correct files are not present. Then again, maybe I misunderstand the point completely.

What I meant is that this forum is generally for all integration code from Uppy. Asking about the best practises to load npm packages into .NET is a .NET question, for which I have zero experience.

Ideally you find yourself something Propshaft from Rails (talk to explain this) for .NET. The fact that Uppy is ESM and the browser supports ESM technically means you don’t have to bundle, you just have to find a clean, minimal way to manage assets.

I never used .NET but I would be surprised if you still have to manually write gulp scripts in 2024.