[Vuejs]-How to override vue cli-service entry settings

0👍

For anyone in a similar situation, I found what worked for me. It’s not the ideal solution due to the fact that it forces you to build into a js folder. That resulted in the file being put in Scripts\build\vue\js. Would be nice to be able to just dump it in the vue folder, but at least this works. Code below.

vue.config.js

module.exports = {
  publicPath : "/",
  outputDir: "Scripts/build/vue", //where to put the files

  // Modify Webpack config
  // https://cli.vuejs.org/config/#chainwebpack
  chainWebpack: config => {
    // Not naming bundle 'app'
    config.entryPoints.delete('app'); //removes what base.js added
  },

  // Overriding webpack config
  configureWebpack: {
    // Naming bundle 'bundleName'
    entry: {
      quote: './Scripts/Quote/index.js' //where to get the main vue app js file
    },
    optimization: {
      splitChunks: false
    }
  },
  filenameHashing: false,
  pages: {
    quoteApp: { //by using pages, it allowed me to name the output file quoteApp.js
      entry: './Scripts/Quote/index.js',
      filename: 'index.html'
    }
  }
}

Leave a comment