Minimize the quantity of files processed by Vue

Here is the content of my vue.config.js file:

css: {
  extract: false,
},
configureWebpack: {
  devtool: 'source-map',
  optimization: {
    splitChunks: false,
  },
},
productionSourceMap: false,

I'm facing an issue where running npm run build results in multiple JS files being generated, each just a few kilobytes in size. How can I reduce the number of HTTP requests?

Entrypoint size limit exceeded: The combined asset size for the following entrypoint(s) exceeds the recommended limit (244 KiB). This could negatively impact web performance.
Entrypoints:
app (2.2 MiB)
  js/app.e5ac77b2.js
File                                    Size          Gzipped
...
(dist\js\chunk-2d0e523f.2a1a17be.js     0.57 KiB      0.38 KiB)

Answer №1

Issue does not lie within your vue.config.js, but rather in your router.js

The problem arises from using async components (

component: () => import('./views/user/SignUp.vue')
) where each import() operation generates a new JS chunk

To optimize Webpack code splitting, you can utilize magic comments. For instance, consolidate all "user" components/routes into a single chunk:

component: () => import(/* webpackChunkName: "user-chunk" */ './views/user/SignUp.vue')

Remember to apply the same comment for all "user" sub-route components

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

In what ways can I apply the outcome of this commitment?

I need help refining the buildQuery function for my social post feed: const buildQuery = (criteria) => { const { userId, interest } = criteria; const query = {}; if (interest !== 'everything') { if (interest === 'myInterests&a ...

Activate AngularJS autocomplete when populating the input field using JavaScript

I'm currently facing an issue with updating the value of an input field on a website using JavaScript. Although I can successfully update the input field's value, I find that I am unable to trigger the autocomplete feature. Interestingly, when ...

Generating separators in every third row using an array of card elements

https://i.stack.imgur.com/PIMR2.png Hey everyone, I'm working on creating a Divider for every row of 3 items. Currently, my setup only handles two sets of rows, but there could be an unlimited amount of rows that need this divider. I am using slice t ...

Issues with the @input listener failing to work on a customized component

I'm currently experimenting with a unique component from the PrimeVue library. It claims to support any event: "Any valid event such as focus, blur and input are passed to the underlying input element." The event listener seems to be workin ...

Whenever Ionic is paired with LokiJS, it consistently results in the error message: "ionic.bundle.js:26794 TypeError: Cannot read property 'insert' of undefined"

Having faced numerous issues with SQLite, I decided to explore LokiJS as an alternative solution for my Ionic app. However, even with LokiJS, I encountered challenges. Currently, I have a simple code that should function smoothly: .controller('Proje ...

Tips for adding extra spacing between icon and text field using Vuetify

The code snippet below is used for the username section: <v-text-field prepend-icon="fas fa-user" height="60px" placeholder="Username" outlined ></v-text-field> Is there a way to add space between the user ...

Steps for installing Vue.js version 2

Looking to upgrade to Vue.js version 2 in order to utilize Vuetify. Can anyone provide me with the command needed for this installation process? Thanks in advance! ...

IE8 does not support Jquery ajax() for cross domain requests to remote servers

My current script includes an ajax request to a remote server that provides a plain text response. This setup functions properly in all browsers with the exception of IE8, which is not surprising. The script snippet looks like this: $.ajax({ url: &apos ...

How to retrieve a single value from a collection document in Meteor

I'm in the process of extracting a specific value from a Meteor collection document to incorporate it into a three.js setting. My goal is to generate a three.js object that makes use of information stored in the database, which remains constant at thi ...

Refresh FullCalendar in Angular 2 and above

Can someone please assist me with re-rendering or redrawing a full-calendar in Angular using @fullcalendar/resource-timeline? I have updated the data after calling the API and now I need to make sure the calendar reflects these changes. Any guidance on h ...

Open the link and input the text into the text box?

Suppose I have the following JavaScript code: <script language="javascript" type="text/javascript"> function addText() { var newText = document.myForm.inputText.value; document.myForm.description.value += newText; } </script> I want t ...

Execute a Gulp task automatically following the installation of an NPM package, no need for

I have created a small Angular package that is available on npmjs. I need to modify the "selector" name when installing my package, so I wrote a gulp task as shown below: gulp.task('tag-change', function () { // var files = fs.readFileSync(&a ...

Issue with Angularjs: NG-repeat and filter not functioning correctly on array

After spending the last 3 hours searching on Google and Stack Overflow, I thought this would be easy, but I'm still stuck. I have a simple ng-repeat where I need to display everything from data2 that matches the unique ID in my data1's ref_id co ...

Error in Syntax & Function is Undefined

issues controllers.js:6 Uncaught SyntaxError: Unexpected token ( ionic.bundle.js:26794 Error: [ng:areq] Argument 'MenuCtrl' is not a function, got undefined In the process of developing a cross-platform app using Ionic framework with WordPress ...

Can Chrome DevTools be used to manipulate the login process?

For a recent project, I utilized the login authentication logic from this GitHub repository as a reference: https://github.com/cornflourblue/angular-authentication-example In a situation where the backend was offline, I manually tweaked the frontend code ...

Making asynchronous requests using AJAX

$.ajax({ async:false, url: "ajax/stop_billed_reservation_delete.php", type: "POST", dataType : "json", data : { "rid" : <?php echo $_GET['reservationId']; ?> }, success: function(result){ ...

DevServer Proxy with Axios Library

Struggling to configure the devServer: proxy setting in my vue / express app. The vue.config.js file can be found in the root of my client folder and it looks like this: module.exports = { devServer: { proxy: { 'api': { targ ...

"Utilize axios in React to interpret and handle error bodies captured through parsing as a ReadableStream

When I sent a post request using axios in a React form to a PHP server, I encountered an issue where the error returned a ReadableStream in its body. However, when I used Postman, I did not have this problem and received readable errors instead. How can I ...

How to automatically generate a serial number using JavaScript each time a click event occurs

continuous problem with repeated serial numbers Serial number remains the same after each click $(document).on('click', '.menu-item', function() { var menu_id = $(this).attr('id'); var _token = $('input[name="_ ...

The THREE.WEBGLRenderer does not exist as a constructor in the three.js library

Hello, I am in need of assistance to solve an error that I have been struggling with. Despite my efforts, I have not been able to find a solution for it. Below is the code snippet causing the issue: const canvas = document.querySelector('.cube ') ...