question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow user to configure the htmlPath (currently public/index.html)

See original GitHub issue

What problem does this feature solve?

I’d like to combine my vue frontend in the same project as my backend which is already making use of the /public folder. It would be nice if I could configure the path to serve out of a folder of my chosing, like /html or something.

What does the proposed API look like?

I believe it could be added to vue.config.js like this:

  // where to serve dev files
  devDir: 'public',

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6

github_iconTop GitHub Comments

8reactions
lbjonescommented, Feb 23, 2018

Nevermind!

I just figured out how to do it configuring webpack directly. In vue.config.js:

const path = require('path');

module.exports = {
  lintOnSave: true,
  chainWebpack: (config) => {
    config
      .plugin('html')
      .tap(() => [{
        template: path.resolve('html/index.html'),
      }]);
  },
};

The path seemed to be hard coded in /node_modules/@vue/cli-service/lib/config/app.js so I assumed I could not configure it, but somehow this code still works.

2reactions
lbjonescommented, Apr 4, 2018

I am also using laravel on the backend. I changed what I originally had done as seen earlier on this thread. What I ended up doing is putting laravel in the root folder and the whole frontend in a folder called vue. Then when it builds, it dumps everything in public/assets. Then for hot code on dev, you need to use a proxy URL. Not sure if it’s the easiest way to do it, but it works.

Here is my vue/vue.config.js file if it helps:

module.exports = {
  // Project deployment base
  // By default we assume your app will be deployed at the root of a domain,
  // e.g. https://www.my-app.com/
  // If your app is deployed at a sub-path, you will need to specify that
  // sub-path here. For example, if your app is deployed at
  // https://www.foobar.com/my-app/
  // then change this to '/my-app/'
  baseUrl: '/assets/',

  // where to output built files
  outputDir: '../public/assets',

  // use the full build with in-browser compiler?
  // https://vuejs.org/v2/guide/installation.html#Runtime-Compiler-vs-Runtime-only
  compiler: true,

  // whether to use eslint-loader for lint on save.
  // valid values: true | false | 'error'
  // when set to 'error', lint errors will cause compilation to fail.
  lintOnSave: true,

  // tweak internal webpack configuration.
  // see https://github.com/vuejs/vue-cli/blob/dev/docs/webpack.md
  configureWebpack: {},

  chainWebpack: (config) => {
    config
      .entry('app')
      .clear()
      .add('./src/index.js')
      .end();
  },

  // vue-loader options
  // https://vue-loader.vuejs.org/en/options.html
  vueLoader: {},

  // generate sourceMap for production build?
  productionSourceMap: false,

  // CSS related options
  css: {
    loaderOptions: {
      sass: {
        includePaths: [
          'node_modules', 'src',
        ],
      },
    },
  },

  // use thread-loader for babel & TS in production build
  // enabled by default if the machine has more than 1 cores
  // parallel: require('os').cpus().length > 1,

  // split vendors using autoDLLPlugin?
  // can also be an explicit Array of dependencies to include in the DLL chunk.
  // See https://github.com/vuejs/vue-cli/blob/dev/docs/cli-service.md#dll-mode
  dll: true,

  // options for the PWA plugin.
  // see https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-pwa
  pwa: {},

  // configure webpack-dev-server behavior
  devServer: {
    open: process.platform === 'darwin',
    host: '0.0.0.0',
    port: 8080,
    https: false,
    hotOnly: false,
    // See https://github.com/vuejs/vue-cli/blob/dev/docs/cli-service.md#configuring-proxy
    proxy: 'http://my-app.test',
    before: () => {},
  },

  // options for 3rd party plugins
  pluginOptions: {},

};
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to redirect the home page of the site to /public/index.html ...
html manually, the site work correctly. The question is: how can force the site to direct to the /public/index.html path when I enter...
Read more >
How do I fix the permissions on my html directory and files?
To fix the permissions on your html directory on Eniac: Visit Personal Homepage. Check the Configure My Account for Webpages box. Click the...
Read more >
How to change the Laravel public folder path
In this post will show how to change the Laravel public folder path (the default path to publish public content, including the index)...
Read more >
HTML and Static Assets - Vue CLI
For new projects, it is now recommended to use create-vue to ... The file public/index.html is a template that will be processed with ......
Read more >
Staticfile Buildpack | Cloud Foundry Docs
This topic describes how to configure and use the Staticfile buildpack. ... To find which version of NGINX the current Staticfile buildpack ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found