Friday, February 17, 2023

Thursday, February 2, 2023

vue integrate with existing asp.net mvc

 


npx vue-cli-service build --mode development --dest ../wwwroot/js  --watch


https://github.com/sunsande/Vue.js-ASP.NET-MVC-intergration


Setting up Mode 3 (or Integrate the Production Versions of Feature1 and Feature2 in ASP.NET MVC View)

First we have to add some options to the vue.config.js:

module.exports = {
    filenameHashing: false,
    productionSourceMap: false,
    outputDir: '../vuejs/',
    configureWebpack: {
        devtool: 'source-map',
        output: {
            filename: '[name].js'
        }
    },
    pages: {
        hanakoFeature1: {
            entry: 'src/hf1.js',
            template: 'public/hanako_feature.html',
            filename: 'index1.html',
            title: 'Hanako Feature 1',
            chunks: ['chunk-vendors', 'chunk-common', 'hanakoFeature1']
        },
        hanakoFeature2: {
            entry: 'src/hf2.js',
            template: 'public/hanako_feature.html',
            filename: 'index.html',
            title: 'Hanako Feature 2',
            chunks: ['chunk-vendors', 'chunk-common', 'hanakoFeature2']
        }
    }
}