Webpack: Use this template as file, not served via HTTP?

Created on 17 Nov 2017  路  3Comments  路  Source: vuejs-templates/webpack

Hi there, first thanks for this amazing template, but im having a little trouble, i created a project with this template, but i wont use as HTTP website, it must be open as a file, i know when i run "npm run build" it shows: "Tip: built files are meant to be served over an HTTP server.
Opening index.html over file:// won't work." but there is anyway to open it as file, and application works?

question

Most helpful comment

@LinusBorg you mean assetsPublicPath, not assetsRootPath
```
build: {
// Template for index.html
index: path.resolve(__dirname, '../dist/index.html'),

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

```

All 3 comments

And if im not clear, i know "npm run dev" but i must have final use (production) without HTTP server..

When you set the assetsRootPath in the /config/index.js file to a relative path (./) it should work.

Note that in this case, vue-router's history mode won't work.

@LinusBorg you mean assetsPublicPath, not assetsRootPath
```
build: {
// Template for index.html
index: path.resolve(__dirname, '../dist/index.html'),

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

```

Was this page helpful?
0 / 5 - 0 ratings