VueJS throwing a missing webpack configuration error

Here is an overview of the package.json file for my Vue.js application:

package.json

{
  "name": "vue_app",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve --open",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "axios": "^0.18.0",
    "vue": "^2.5.13",
    "vue-router": "^3.0.1",
    "vuex": "^3.0.1"
  },
  ...
}

<p>After building the Vue app, it generates an index.html file located at:</p>

<p><code>dist/index.html

<body>
    <noscript><strong>We're sorry but vue_app doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript>
    ...
</body>

The issue arises when attempting to fetch static files - specifically /js/vendor.be88a6a7.js returns a 404 error. However, calling /static/js/vendor.be88a6a7.js successfully retrieves the file. To resolve this, I had to prepend /static to all static URL paths. Unfortunately, I could not find a webpack.conf file in that directory.

View source code here

Answer №1

Vue CLI 3 simplifies the webpack configuration process by generating the config file dynamically at runtime, eliminating the need for users to manually edit it. This abstraction is why you may not see a webpack config file in your project directory.

If you do need to access the webpack config file, you can find it here:

<projectRoot>/node_modules/@vue/cli-service/webpack.config.js

The dynamically resolved file sets output.publiPath to / by default. To view the contents of the webpack config file, use either the vue inspect command in your terminal or navigate to vue ui -> Tasks -> inspect.

To customize the webpack configuration, create a vue.config.js file in the root directory of your project and add the following code:

// vue.config.js
module.exports = {
    configureWebpack: {
        output: {
            publicPath: '/static/'
        }
    }
}

For further information, refer to the following resources:

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

The TypeScript compiler is unable to locate the module react-scripts within the lerna webpack configuration

Recently, I've been working on setting up a new project using lerna, react-scripts, webpack, and sass. Here is my current directory structure: myApp /packages /myReactApp -> a react create app application /tsconfig.json /package ...

Finding the way to locate obsolete or deprecated packages in NPM versions

Is there a way to easily identify outdated deep dependencies in the local node_modules folder, separate from the top-level packages? After running the command: npm install with this content in my package.json: "dependencies": { "bluebi ...

Eliminating the excessive space underneath the collapsible section when it is expanded

I am facing an issue with a hidden html table inside a collapsible element. Whenever the collapsible is expanded, there seems to be a substantial gap below the table. I'm unable to identify the cause of this problem. Below, you will find images and a ...

How to load MTL files from local storage using Three.js in Chrome

I'm encountering an issue when attempting to load MTL files using Three.js on Chrome. While everything runs smoothly on Safari, I keep running into a cross-origin request error in Chrome when working with local files. I'm at a loss on how to reso ...

Using jQuery to retrieve the initial object in an array following an Ajax request

I need to retrieve the first object returned by an AJAX call before looping through it with the each() function. Here's the current code that successfully loops through the data: $.each(obj.DATA, function(indexInArray, value) { var depts ...

Struggling to display the retrieved data on the webpage

Code in pages/index.js import React from 'react'; import axios from 'axios'; import ListProducts from '@/components/products/ListProducts'; const getProducts = async () => { const data = await axios.get(`${process.env.AP ...

Tailwind.css - a "sticky" element is positioned outside of the parent "wrapper" element

Seeking your kind assistance. I am facing an issue where a fixed element is being displayed outside the parent container on large screens, as it is treated as "fixed" from the viewport rather than relative to its parent element. https://i.sstatic.net/mw2 ...

Guiding motion of a parental container using a button

This seems like a fairly straightforward task, but I'm getting a bit frustrated with it. Is there a way to move an entire div by simply holding down the mouse button on a particular button? let container = document.getElementById('abo ...

Convert your AS3 code to JavaScript with our specialized compilers

Recently, I came across the AS3 to JS compiler known as Jangaroo. It caught my attention because it seems like a valuable tool that aligns well with my preferences in AS3. Are there any similar compilers out there? Is there another programming language ...

Retrieving JSON information from an external API

Having trouble retrieving data from an API to populate the "output" div. The error message says that $ is undefined. Any ideas on what could be missing? <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http ...

Envelop a HTML element within another HTML element with the help of jQuery

Unique link Here is some sample HTML: <div><img src="http://i.imgur.com/4pB78ee.png"/></div> I am looking to use jQuery to wrap the img tag with an a tag, like this: $(function() { var a = '<a href="http://i.imgur.com/4pB78e ...

struggling to retain data within scope when utilizing localstorage in angular

Currently, I am utilizing the fileReader to read a file, save the image in localStorage, and then display it on the view. In the controller: angular.module('App')controller('publsherProfileEditCtrl', ['$rootScope', '$sc ...

When the onChange event is triggered, the current value in my text input field disappears in React

Just starting out with Reactjs and I'm working on creating a page where users can edit their own posts. Currently, when I try to modify the existing text in the text input, the form gets cleared and the user has to re-enter the data. This is not the b ...

Firefox is unable to display SWF files

My code snippet: <div id="sw" style="cursor:pointer" > <object id="swfobj" type="application/x-shockwave-flash"> </object> The JavaScript part: function openfile(filePath) { $("#swfobj").attr("data", filePath); $("#sw ...

An issue occurred when attempting to integrate Angular

Currently, I am in the process of learning AngularJS. To practice, I attempted a simple code snippet in an HTML file: <!DOCTYPE html> <html lang="en" ng-app=""> <head> <meta charset="utf-8"> &l ...

Pnotify encounters a glitch where the buttons are not displayed when utilized with jquery

Using pnotify with jQuery and Bootstrap3, I am facing an issue where the buttons do not appear. In order to address this problem, I have ensured that both pnotify.custom.min.css and pnotify.custom.min.js files are included in the header of the application ...

Guide on sending a message to a specific channel using Discord.js version 13 with TypeScript

After recently diving into TypeScript and seeing that Discord.js has made the move to v13, I have encountered an issue with sending messages to a specific channel using a Channel ID. Below is the code snippet I am currently using: // Define Channel ID cons ...

Adjust the color of TextareaAutosize component using mui in React

Just starting out with React and getting acquainted with mui components. Experimenting with setting the color of a TextareaAutosize mui component using this code: import * as React from 'react'; import TextareaAutosize from '@mui/material/T ...

Having trouble deciphering mathematical formulas while editing content on ckeditor

While using math formulas in CKEditor, I noticed that when I insert new content via textarea, the formulas are displayed correctly. However, when I go back to edit the content, the text formulas do not display as before. This is the source code I am using ...

Is there a way for me to invoke a different function that is located external to

I am currently in the process of setting up an event that triggers on any change within the form input class. import React, { useState } from "react"; DealerRegistration extends React.Component { state = { business_type : 'd ...