vue-cli3 多页面应用静态资源按页面分类打包

vue.config.js:

pages: {

    'steps/index': {

        entry: 'src/entry/steps/main.js',

        template: 'public/index.html',

        filename: 'index.html',

        chunks: ['chunk-vendors', 'chunk-common', 'steps/index']

    },

    'template1/template1': {

        entry: 'src/entry/template1/main.js',

        template: 'public/template.html',

        filename: 'template1.html',

        chunks: ['chunk-vendors', 'chunk-common', 'template1/template1']

   },

    'template2/template2': {

        entry: 'src/entry/template2/main.js',

        template: 'public/template.html',

        filename: 'template2.html',

        chunks: ['chunk-vendors', 'chunk-common', 'template2/template2']

    }

}

【重点】

pages的key值,使用目录结构。生成的静态资源,就会按这个目录存放。

注意,不是chunks的值决定了静态资源的存放目录,是pages的key。


打包后的静态资源(只有img文件夹里面没有分类)

vue-cli3 多页面应用静态资源按页面分类打包_第1张图片

你可能感兴趣的:(vue-cli3 多页面应用静态资源按页面分类打包)