What is the process for modifying the main.js file path in vue-cli?

I'm currently using vue-cli

I have a need to modify the file path for main.js and other vue source files

Therefore, I attempted to make changes in build/webpack.base.conf.js

Here's a snippet of the code before the modification:

module.exports = {
  entry: {
    app: './src/main.js'
  },

And here's how it looks after the change:

module.exports = {
  entry: {
    app: '../src/main.js'
  },

I then tried to run:

npm run dev

However, it didn't work as expected and displayed the following error message:

...

The error indicates that certain dependencies were not found at the new path location. It suggests running npm install to resolve this issue.

How can I successfully alter the vue source path?

Your assistance is greatly appreciated!

Answer №1

Is the file main.js located in that specific path?

Below are two directory structures that look exactly the same:

- root directory
 - src
     - main.js
 - directory
     - package.json
      - other files..

If the vue files are within this pathway.

- root directory
 - src
     - main.js
 - directory
     - src
          - App.vue
     - package.json
      - other files..

You will need to import from main.js as

import App from '../directory/src/App.vue'

However, if the vue files are situated in the following location.

- root directory
 - src
     - main.js
     - App.vue
 - directory
     - package.json
      - other files..

You should import from main.js like this: import App from './App.vue'

Could it simply be a matter of moving main.js?

Let's double-check main.js for clarification.

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

Error 404: This page seems to have gone missing. Django and react-router

Struggling to integrate reactjs and react-router (1.x) with my Django project. I'm finding it challenging to make everything work together seamlessly. For more details, you can check out the project on GitHub: https://github.com/liondancer/django-che ...

Which is better: JavaScript, Json, or Html?

When working with an ASP.NET MVC view and using jQuery AJAX to update a div, the decision on whether to use a controller that returns a PartialView or JSON can depend on various factors. Consideration for both user experience and system performance is im ...

Looking to add some color to the tags within an XML document that is being shown in a textarea?

Currently, I am attempting to add color to the tags within an XML string that is being displayed in a textarea on an HTML page. For example, let's say I have an XML string stored in a variable called 'xmldata'. The HTML textarea tag looks ...

The appearance of the pop-up mask is displayed at lightning speed

Check out the demo here Here is the HTML code: <div class="x"> </div> <input class="clickMe" type="button" value="ClickMe"></input> This is the JS code: $(".clickMe").click( function() { ...

Even after being removed, the input field in Firefox stubbornly maintains a red border

I have a project in progress that requires users to input data on a modal view and save it. The validation process highlights any errors with the following CSS snippet: .erroreEvidenziato { border: 1px solid red; } Here is the HTML code for the moda ...

Utilizing React Render Props to Pass References Between Components

Is there a way to access a ref that is passed between two external components using render props? I am trying to achieve something similar to this example usage. function Component() { // how can I retrieve the `ref` here? return ( <A> ...

Utilizing a range input (slider) to extract data of importance

When dynamically adding a slider to a page using a specific string, like the one shown below: "<input type=\"range\" name=\"aName\" min=\"1\" max=\"9\"/>"; After appending it to the page with pure JavaScript, ...

storing a value in the browser's local storage

I am in the process of creating a new game that includes a high score feature. The idea is that when the current score surpasses the existing one stored locally, it will be replaced: localStorage.setItem('highScore', highScore); var HighScore = ...

Attempting to retrieve key-value pairs from a nested JSON array

I am attempting to extract values along with their corresponding key names from a nested JSON array resData =[ { _index: 'web', _type: 'event', _id: 'web+0+93', _score: null, _source: { 'os-nam ...

Sending a blob through AJAX to a different domain using CORS

Could someone please explain why my current request is being blocked by the SO policy restriction? Javascript Code: var blob = new Blob([req.response], {type: "application/octet-stream"}); req = new XMLHttpRequest(); req.open("POST", ws_path(other_contex ...

The error message "Exceeded the maximum call stack size in Javascript"

My current project involves using socket.io for sending and receiving data from a server. I have implemented a "Create Game" button on the client side that triggers the creation of a new GameServer on the server side. Following that, I am displaying the ga ...

Using the built-in http module in node.js to upload images via multipart/form-data

I have encountered an issue where I need to send two images and an API key as part of a multipart/form-data HTTP request to an API. The images are retrieved from an AWS S3 bucket, which works fine. However, when attempting to send the image data as part ...

transferring data between pages without the need for a form tag

<a href='new.php?logi_jo=$_POST[jo]'>submit</a> <input type='text' style='width:50px' name='logi_jo'> Is there a method to extract the value of logi_jo and transfer it to another webpage without u ...

A guide to iterating through a multidimensional array and assigning fields as keys

In my possession is an object configured as follows: [ { "ID": 34, "parent": 0, "title": "Level 1 A", "children": [] }, { "ID": 35, "parent": 0, "title": "Level 1 B", "children": [ { "ID": 36, "p ...

failure of pipe during search for art gallery information

Hi, I've created a filter pipe to search for imagenames and imageids among all my images. However, it seems to only find matches in the first image. There seems to be something wrong with my code. This is my FilterPipe class in filter.pipe.ts where I ...

Switch up the key while iterating through a JSON object

Can you modify the key while iterating through objects using an external variable? Picture it like this: var data = [{ "id": 1, "name": "Simon", "age": 13 }, { "id": 2, "name": "Helga", "age": 18 }, { "id": 3, "name": "Tom ...

Updating class with jQuery based on dynamically changing content

I am using countdown.js to create a custom countdown timer. My goal is to replicate the countdown timer seen on the homepage, but with the ability to change the target date (which I have already accomplished). Here is an example of what I currently have f ...

Updating a section of a webpage using jQuery Mobile

I'm currently facing an issue with modifying a specific section of my webpage. Although this problem has been discussed before, I haven't found a satisfactory solution yet. The element in red on the page needs to change dynamically based on the ...

React Href is not functioning as expected in relative paths

Recently, I delved into React apps and managed to create one with a router. Everything was smooth sailing in dev mode until I tried running index.html from the build folder after npm run build. It seems like all the href links are broken. I suspect somethi ...

Challenges arise when using ui-select with both multiple selection and asynchronous options

I'm encountering an issue with the ui-select directive (using AngularJS 1.6.4 and Ui-select 0.19.8). You can find my created fiddle here. The dropdown is supposed to display contacts when I type more than 3 characters, without any filtering applied ...