Accessing index.html via file:// from Vue-cli template

Whenever I execute the npm run build command using this Vue-cli template, it displays this message:

Hint: The built files are designed to be served over an HTTP server.

Attempting to open index.html via file:// will not function correctly.

Therefore, the question remains - is it feasible to open index.html using file:// and have it work properly?

Answer №1

To make the change, adjust assetsPublicPath to './'. Next, execute "npm run build". Finally, you can view the result by opening file:// in your browser.

  build: {
    // Specifies the index.html template
    index: path.resolve(__dirname, '../dist/index.html'),

    // File paths
    assetsRoot: path.resolve(__dirname, '../dist'),
    assetsSubDirectory: 'static',
    assetsPublicPath: './',     

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

Calculator for calculating values using JavaScript data attributes

One issue is that certain elements are canceling each other out.. The value of the element is specified in the "data-price" attribute. My code is currently not valid and does not handle it properly, ideally I would like to update the total whenever a selec ...

Cross-building targets for Node modules for deployment on npm platform

I'm working on an ES6 module that needs to be compatible with different environments. I'm not sure whether to use webpack or rollup for building, and how to target specific environments. Building for Different Environments ES6 environments like ...

Tips for specifying minimum length in the v-autocomplete component in Vuetify

Within my code, I incorporate the v-autocomplete UI Component. Is there a way to configure it so that it only starts searching after a minimum length of 3 symbols? Typically, the default minimum length is set to 1 symbol, and it shows the no-data-text mes ...

Tabindex issue arises due to a conflict between Alertify and Bootstrap 4 modal

When trying to call an Alertify Confirmation dialog within a running Bootstrap 4 Modal, I encountered an issue with the tab focus. It seems to be stuck in the last element and not working as expected. I suspect that this might have something to do with th ...

React JS alterations in circular word cloud

I have a unique project with a dynamic word cloud feature displaying random words. My goal is to customize the code so that the word cloud can showcase specific words from a list of my selection, like: let WordList = ['Apple', 'Banana' ...

A self-destructing javascript/jquery function that removes itself after running

For a very detailed analytics insight, I am sending an ajax request to my controller in order to update the user's interaction (such as which pages they visit or like) and store this information in my MongoDB. All I want is for this script to be dele ...

VueJS: Unable to loop through an Object

Here is the code snippet that I am currently working with: console.log("My Object is:"); console.log(this.LoadedBaseMapLayersContent); for(obj of this.LoadedBaseMapLayersContent) { // console.log(obj); console.log("can't get this string"); } I am ...

Vuejs is throwing an uncaught promise error due to a SyntaxError because it encountered an unexpected "<" token at the beginning of a JSON object

I am currently attempting to generate a treemap visualization utilizing data sourced from a .json file. My approach involves employing d3 and Vue to assist in the implementation process. However, upon attempting to import my data via the d3.json() method ...

Creating adaptable HTML images by specifying width and height attributes within the image tag

My current website setup involves loading a full image and automatically adjusting its size to fit the screen by setting the image width to 100% in CSS. While this method works smoothly, it may not be following standards as I am not specifying width and he ...

How can I create a fading trail effect in Three.js that diminishes over time?

I am interested in achieving a similar effect to the example I found on this website: However, my goal is to have the old trail gradually fade into the background over time instead of cluttering the screen with persistent marks. I discovered that by usin ...

Getting data in a ng-Dialog Modal with AngularJS is a breeze!

Hi there, I'm new to Angular JS and facing an issue with displaying data from my MySQL database in a table as well as in a modal for more detailed information: I've included the HTML file named _detail_modal.html at the bottom of the page. ...

What makes NPM thrive while submodules struggle with construction?

My experience with utilizing npm has often involved encountering seemingly meaningless errors - such as Visual Studio projects failing to build and build tools (e.g. python.exe / CL.exe) being unavailable on the command line. For instance, some packages t ...

Motion of the atoms

I recently came across an interesting effect on the IconArchive website, but I am unsure how to implement it. If anyone could help me understand the concept with a small example, that would be greatly appreciated. You can see the effect in action by visi ...

What is a callback function tied to a specific URL?

I need to implement a functionality in my web application where users can click on a link within a datatable, which will then load a new table on a separate page. This new table should only display rows that have the same id as the row that was clicked on ...

Generating rows within Angular while implementing ng-repeat

In my code, I am facing an issue where posts from the API are being repeated and displayed in rows of 9. My objective is to create a grid layout with 3 rows, each containing 3 posts. Unfortunately, the solution I attempted did not work as expected. I also ...

The instruction to execute "npm install --loglevel=error" resulted in an exit status of 9009

I'm currently attempting to execute the "PartsUnlimited" project that I cloned from GitHub, but I keep encountering this error: Upon running the command "npm install -- loglevel=error," I am receiving exit code 9009. I've been struggling to c ...

Surprisingly, the nodemon dev dependency in the Docker container continues to function even after running npm ci

I am currently working on a Node/Express/TypeScript application with nodemon hot reload feature. Nodemon is listed as a development dependency in my package.json file. Running the script npm run dev executes npx nodemon src/app.ts, and it functions proper ...

Resolving dependencies for the 'root' package.json appears to be ineffective despite efforts to force resolutions

Looking at the package.json file of my application, I have specified: "dependencies": { "axios": "0.21.2", .... }, "resolutions": { "axios": "0.24.0" }, "scripts": { &q ...

Building a single page web application using TypeScript and webpack - a step-by-step guide

For a while now, I've been working on single page applications using Angular. However, I'm interested in creating a single page application without utilizing the entire framework. My goal is to have just one .html file and one javascript file, w ...

What is the recommended approach for defining the files field in the package.json file?

In my package.json file, I have specified the files as "files": ["./src", "/.lib"] This entry in the package.json is intended to achieve the following: The optional files field contains an array of file patterns that dictat ...