copy a folder from node_modules to public folder
how can I do this without manually copying it
its required for a sdk im using
2 Replies
Hi @nvme. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
The knowledge sources do not provide a built-in Nuxt command or configuration to automatically copy a folder from node_modules to the public directory during build or development. However, you can achieve this by using a custom script or a build tool (like a postinstall or build hook in your package.json) to copy the required files.
For example, you could add a script in your package.json like:
This approach is not Nuxt-specific but is a common practice in Node.js projects.
If you are developing a Nuxt module, you can expose a folder of assets through Nitro’s publicAssets option, which allows you to serve files from a specific directory without copying them manually. Here’s an example from the documentation:
This method is intended for module authors, but it demonstrates how to programmatically expose assets for public access in a Nuxt app Injecting Other Assets.
If you need a solution for a regular Nuxt project (not a module), you will need to use a custom script as described above, since the knowledge sources do not mention a built-in Nuxt feature for this use case.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
<@1265695120725119036> Kapa.ai is still learning and improving, please let me know how I did by reacting below.