小程序上线遇到了问题

小程序上线遇到了几个问题
1.npm run dev正常,npm run build报错,不知道有无影响

小程序上线遇到了问题

2.上传代码的时候有两个页面没有打包 不知道什么原因

小程序上线遇到了问题

3.我的项目发布,体验版本 手机拉去不到数据 ,我项目已经在阿里云发布,https://weapp.czmark.com

小程序上线遇到了问题
package.json代码

{
  "name": "larabbs-weapp",
  "version": "0.0.2",
  "description": "larabbs weapp project",
  "main": "dist/app.js",
  "scripts": {
    "dev": "wepy build --watch",
    "build": "cross-env NODE_ENV=production wepy build --no-cache",
    "dev:web": "wepy build --output web",
    "clean": "find ./dist -maxdepth 1 -not -name 'project.config.json' -not -name 'dist' | xargs rm -rf",
    "test": "echo \"Error: no test specified\" && exit 1",
    "eslint": "eslint --fix --ext .js,.wpy src"
  },
  "wepy": {
    "module-a": false,
    "./src/components/list": "./src/components/wepy-list.wpy"
  },
  "author": "110733448@qq.com",
  "license": "MIT",
  "dependencies": {
    "moment": "^2.24.0",
    "promise-polyfill": "^8.1.0",
    "redux": "^3.7.2",
    "redux-actions": "^2.2.1",
    "redux-promise": "^0.5.3",
    "wepy": "^1.6.0",
    "wepy-async-function": "^1.4.7",
    "wepy-com-toast": "^1.0.2",
    "wepy-plugin-imagemin": "^1.5.3",
    "wepy-plugin-replace": "^1.5.10",
    "wepy-redux": "^1.5.3"
  },
  "devDependencies": {
    "babel-eslint": "^7.2.1",
    "babel-plugin-transform-class-properties": "^6.24.1",
    "babel-plugin-transform-decorators-legacy": "^1.3.4",
    "babel-plugin-transform-export-extensions": "^6.22.0",
    "babel-plugin-transform-object-rest-spread": "^6.26.0",
    "babel-preset-env": "^1.6.1",
    "cross-env": "^5.1.3",
    "eslint": "^3.18.0",
    "eslint-config-standard": "^7.1.0",
    "eslint-friendly-formatter": "^2.0.7",
    "eslint-plugin-html": "^2.0.1",
    "eslint-plugin-promise": "^3.5.0",
    "eslint-plugin-standard": "^2.0.1",
    "less": "^3.8.1",
    "wepy-compiler-babel": "^1.5.1",
    "wepy-compiler-less": "^1.3.10",
    "wepy-eslint": "^1.5.4"
  }
}

app.js代码

import wepy from 'wepy'

//服务器接口地址
const host = __BASE_URL__

wepy.config.js代码

const path = require('path');
var prod = process.env.NODE_ENV === 'production';

module.exports = {
  wpyExt: '.wpy',
  eslint: true,
  cliLogs: !prod,
  build: {
    web: {
      htmlTemplate: path.join('src', 'index.template.html'),
      htmlOutput: path.join('web', 'index.html'),
      jsOutput: path.join('web', 'index.js')
    }
  },
  resolve: {
    alias: {
      counter: path.join(__dirname, 'src/components/counter'),
      '@': path.join(__dirname, 'src')
    },
    aliasFields: ['wepy', 'weapp'],
    modules: ['node_modules']
  },
  compilers: {
    less: {
      compress: prod
    },
    /*sass: {
      outputStyle: 'compressed'
    },*/
    babel: {
      sourceMap: true,
      presets: [
        'env'
      ],
      plugins: [
        'transform-class-properties',
        'transform-decorators-legacy',
        'transform-object-rest-spread',
        'transform-export-extensions',
      ]
    }
  },
  plugins: {
    replace: {
      filter: /\.js$/,
      config: {
        find: /__BASE_URL__/g,
        replace: prod ? "'https://weapp.czmark.com/api'" : "'http://larabbs.test/api'"
      }
    }
  },
  appConfig: {
    noPromiseAPI: ['createSelectorQuery']
  }
}

if (prod) {

  // 压缩sass
  // module.exports.compilers['sass'] = {outputStyle: 'compressed'}

  // 压缩js
  module.exports.plugins = {
    uglifyjs: {
      filter: /\.js$/,
      config: {
      }
    },
    imagemin: {
      filter: /\.(jpg|png|jpeg)$/,
      config: {
        jpg: {
          quality: 80
        },
        png: {
          quality: 80
        }
      }
    },
    replace: {
      filter: /\.js$/,
      config: {
        find: /__BASE_URL__/g,
        replace: prod ? "'https://weapp.czmark.com/api'" : "'http://larabbs.test/api'"
      }
    }
  }
}

请求帮助下,让我感受下成功的喜悦

TigerLin
《L01 基础入门》
我们将带你从零开发一个项目并部署到线上,本课程教授 Web 开发中专业、实用的技能,如 Git 工作流、Laravel Mix 前端工作流等。
《L05 电商实战》
从零开发一个电商项目,功能包括电商后台、商品 & SKU 管理、购物车、订单管理、支付宝支付、微信支付、订单退款流程、优惠券等
讨论数量: 4
liyu001989

cross-env 没有,yarn global add cross-env 然后再试试

4年前 评论
TigerLin

@liyu001989 安装后没有好使,我去掉了cross-env 提示缺失了个文件,安装后可以了

file

但是微信开发工具出现了很多错误 ,我域名可以访问网站,为什么出现报错 继续找找原因去

file

4年前 评论
TigerLin

问题一个接一个,终究还是搞定了 :smile:(开心一下)
和大家分享一下遇到的问题:
1.上面的报错是由于在学习的时候我们创建了api的分支,而我拉取得是主干,所以并没有api分支的代码;
2.在上线过程中,又遇到了一个127.0.0.1:6379的拒绝访问,百度了下 是redis的连接问题,我在我的服务器安装了redis,同时还要修改一下App/Models/Traits/LastActivedAtHelper.php 里面redis的 use路径 ,use Illuminate\Support\Facades\Redis; 就顺利成功访问了 ,先开心一下

4年前 评论
liyu001989

恭喜恭喜

4年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!