It is Possible to exclude folder in /server/local/** to not build in npx nuxi build ?

I use /server/local to use to test my dummy data from REST API and use useFetch to /public to switching real other Host API. but, when build the live project the folder /server/local is included and i don't needed. How to not included it so the build output has smaller size ?
3 Replies
kapa.ai
kapa.ai5w ago
Hi @Disturbing the Peace. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Yes, it is possible to exclude folders from being included in the build output when using npx nuxi build. To achieve this, you can use the ignore option in your nuxt.config file. Here's how you can do it: 1. Open your nuxt.config.ts (or nuxt.config.js) file. 2. Add the ignore option to your configuration:
export default defineNuxtConfig({
ignore: [
'server/local/**'
],
// ... other configuration options
})
export default defineNuxtConfig({
ignore: [
'server/local/**'
],
// ... other configuration options
})
This configuration will tell Nuxt to ignore the server/local folder and all its contents during the build process. Additionally, you can use the .nuxtignore file to achieve the same result. Create a .nuxtignore file in your project's root directory and add the following line:
server/local/**
server/local/**
Both methods will prevent the server/local folder from being included in your build output, resulting in a smaller build size. For more information on ignoring files and folders in Nuxt, you can refer to the following documentation: Nuxt Configuration Reference .nuxtignore Documentation These methods will help you exclude your local test data from the production build, keeping your build output smaller and more focused on the necessary files for your live project. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai5w ago
<@420021978737541132> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Disturbing the Peace
Thank you kapa.ai

Did you find this page helpful?