美文网首页
vue+移动端+hbuilder打包生成APP

vue+移动端+hbuilder打包生成APP

作者: 五四青年_4e7d | 来源:发表于2020-03-02 00:28 被阅读0次

    1.以vue2.0为例创建项目https://www.jianshu.com/p/f62a720c563e
    2.项目结合rem+vant,业务逻辑这里不讲了,https://www.jianshu.com/p/58d58ae52730
    3.项目打包前配置config文件夹下index.js(assetsPublicPath: '/',)换成(assetsPublicPath: './',):

    
      build: {
        // Template for index.html
        index: path.resolve(__dirname, '../dist/index.html'),
    
        // Paths
        assetsRoot: path.resolve(__dirname, '../dist'),
        assetsSubDirectory: 'static',
        assetsPublicPath: './',
    
        /**
         * Source Maps
         */
    
        productionSourceMap: true,
        // https://webpack.js.org/configuration/devtool/#production
        devtool: '#source-map',
    
        // Gzip off by default as many popular static hosts such as
        // Surge or Netlify already gzip all static assets for you.
        // Before setting to `true`, make sure to:
        // npm install --save-dev compression-webpack-plugin
        productionGzip: false,
        productionGzipExtensions: ['js', 'css'],
    
        // Run the build command with an extra argument to
        // View the bundle analyzer report after build finishes:
        // `npm run build --report`
        // Set to `true` or `false` to always turn it on or off
        bundleAnalyzerReport: process.env.npm_config_report
      }
    

    4.项目完成执行npm run build生成dist文件夹
    5.在HBuilder中创建选择项目:


    image.png

    6.app配置:将dist文件夹打开复制进桌面创建的项目(替换):


    image.png
    7.在项目manifest.json中配置应用标识:
    image.png
    8.打包测试(使用公共测试):
    image.png

    9.创建成功:


    image.png
    10.成功:
    image.png

    相关文章

      网友评论

          本文标题:vue+移动端+hbuilder打包生成APP

          本文链接:https://www.haomeiwen.com/subject/kbyrkhtx.html