Is there a way to prevent certain folders that have .vue files from being included in the VueJS build process?

https://i.sstatic.net/YU1rB.png

module.exports = {
  presets: [
    '@vue/app'
  ],
  module:{
    rules: [
      {
        test: /\.vue$/,
        exclude: [
          './src/components/Homepages/number1',
          './src/components/Homepages/number2'
        ]
      }
    ]
  }
}

I have a specific requirement where I need to conditionally include only one of 'Homepages/number1', 'Homepages/number2', 'Homepages/number3' folders in my project while excluding the others when running npm run build. This is to reduce the size of my dist folder. I've tried the code above in my babel.config.js file, but I'm not confident it's the correct solution. Any advice or suggestions would be greatly appreciated.

Answer №1

If you're looking for a solution, the Copy plugin could be a good option:

In your webpack configuration file:
module.exports = {
  plugins: [
    new CopyPlugin({
      patterns: [
        {
          from: path.posix.join(
            path.resolve(__dirname, "src").replace(/\\/g, "/"),
            "**/*"
          ),
          globOptions: {
            ignore: [
              // Exclude all `txt` files
              "**/*.txt",
              // Exclude all files within subdirectories
              "**/subdir/**",
            ],
          },
        },
      ],
    }),
  ],
};

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Delete all offspring nodes from the Google organization chart

I am currently utilizing the Google Organization Chart to create a chart that resembles the attached screenshot. There is a specific method called removeRow(nodeIndex) that I am using to eliminate a node from the chart. However, one issue I faced is that ...

React component stuck in endless loop due to Intersection Observer

My goal is to track the visibility of 3 elements and update state each time one of them becomes visible. Despite trying various methods like other libraries, useMemo, useCallback, refs, etc., I still face challenges with my latest code: Endless loop scenar ...

How can Node.js and Express be used to conceal Javascript code on the backend?

I'm a beginner when it comes to Node and Express. I have a query regarding how to securely hide Javascript code on the backend. Currently, I am working with Node.js and Express. My goal is to prevent users from easily accessing the code through browse ...

How to Use jQuery in Thymeleaf to Toggle All Checkboxes

Why isn't the function of selecting and deselecting all fields working correctly for me? Can anyone explain what may be causing this issue? ..... <head> <meta name="viewport" content="width=device-width, initial-scale=1.0&q ...

Showing skeleton placeholders while waiting for the completion of an Array map function in React

I am currently working on a country list component that includes phone codes, country names, and flags. The use of the map() function is causing some delay in loading time. I am looking for a way to determine if the map() function has finished executing or ...

In React/Next.js, it seems that pressing the useState button twice is required in order for an event to trigger

When working with react/nextjs, I encountered an issue with a click event where I'm trying to use setState to modify an array. Strangely, the modification only takes effect after two clicks of the button. Here is the initial state array: const [array ...

Incorporating OpenRouteService into an Angular application on Stackbliz

I am encountering an issue with integrating OpenRouteService into my Stackblitz application. The component code is as follows: import { Component, OnInit } from '@angular/core'; import {Location} from '@angular/common'; import {Openro ...

Determine the quantity of items that meet specific criteria

The initial state of my store is set as follows: let initialState = { items: [], itemsCount: 0, completedCount: 0 }; Whenever I dispatch an action with the type ADD_ITEM, a new item gets added to the items array while also incrementing the count in ...

Texture mapping in THREE.JS can be applied to ExtrudeGeometry for enhancing the appearance

Currently, I am tackling an issue concerning three.js and ExtrudeGeometry. The challenge at hand involves a wave-like structure composed of multiple individual frames, each being extruded using ExtrudeGeometry. https://i.sstatic.net/juEBb.jpg My goal is ...

Using vue.js to make an HTTP GET request to a web API URL and display

I am currently utilizing vue.js to make an http request to a web api in order to retrieve a list of projects and display them in a list. However, I am encountering an issue where only one item from the response array of eight items is being rendered. Any a ...

A guide on adding a hyperlink to a table in Node.js using officegen

Currently, I am utilizing a widely-used Node.js library for generating MS Office Word documents. In the officegen module, the code below is used to create a table. When a raw string is provided to the 'val' property inside the table, it generate ...

Ways to halt a message callback?

Looking at some lines of code from a canvas sprite animation on GitHub, I am curious about how to stop the animations once the sprite has finished. window.requestAnimFrame = (function(callback) { // Function for handling animation frames return window.r ...

In what way does this closure cause componentDidUpdate to mimic the behavior of useEffect?

Recently, I came across an insightful article by Dan Abramov titled: A Complete Guide to useEffect. In the section that discusses how Each Render Has Its Own… Everything, two examples were provided. The first example demonstrates the usage of useEffect a ...

Guide to accessing the content within an h1 tag with JavaScript

I currently have a setup with 3 pages: 2 of them are WordPress pages while the other page is a custom page template featuring a form. The first two pages were created using the wp-job manager plugin. The first page includes a dropdown menu with a list of a ...

Can a Set (or Map) be held in a "frozen" state?

Despite the fact that Set is an Object, Object.freeze() specifically operates on the properties of the object, a feature not utilized by Map and Set: for example let m = new Map(); Object.freeze(m); m.set('key', 55); m.get('key'); // == ...

The loading of content will happen only after the fadeOut effect

I'm attempting to incorporate content loading between fadeOut and fadeIn. When I execute the code below, the content loads before the fadeOut is complete: $("#contentArea").fadeOut(1000); $("#contentArea").promise().done(); $("#contentArea").load(c ...

Passing props down in Next.js when working with children components

Within my Next js page, I have a component structured as follows: ... <Chart isShoppingChartOpen={isShoppingChartOpen} toggleShoppingChart={toggleChartVisibility} lineItems={lineItems} /> <main className= ...

the drawbacks of using mixins as outlined in Vue's official documentation

The documentation mentions a downside to mixins in Vue 2. One limitation is reusability: as parameters cannot be passed to the mixin in order to change its logic, their flexibility in abstracting logic is reduced. I'm struggling to fully grasp this ...

Tips for exchanging JSON data between HTML and PHP using jQuery Ajax?

Hello there! I am just starting to learn PHP and jQuery, and I have been experimenting with some code to understand how things work. However, I seem to be having issues with sending data back and forth between my webpage and the PHP file on the server. Her ...

Vue component with a variable number of rows, each containing a variable number of input fields

I am currently working on creating a form that can have a variable number of steps. Users should be able to add an additional step by clicking a button. Each step will contain some input fields and buttons to dynamically create more input fields. For inst ...