求助发布线上报错:Can not find proper registered route for 问题



  • 线上目录要加上/womobile
    完整目录是host/womobile/xxx
    所以加了publicPath: /womobile
    启动项目报错,Can not find proper registered route for,遇到过相同问题的好心人来个指点

    ****************index.js

    
    const path = require('path')
    const config = {
      projectName: 'wo_wap',
      date: '2020-06-01',
      designWidth: 750,
      deviceRatio: {
        '640': 2.34 / 2,
        '750': 1,
        '828': 1.81 / 2
      },
      sourceRoot: 'src',
      outputRoot: 'dist',
      alias: {
        '@': path.resolve(__dirname, '..', 'src'),
      },
      babel: {
        sourceMap: true,
        presets: [
          ['env', {
            modules: false
          }]
        ],
        plugins: [
          'transform-decorators-legacy',
          'transform-class-properties',
          'transform-object-rest-spread',
          ['transform-runtime', {
              helpers: false,
              polyfill: false,
              regenerator: true,
              moduleName: 'babel-runtime'
            }
          ]
        ]
      },
      // plugins: {
      //   uglify: {
      //     enable: true
      //   },
      //   csso: {
      //     enable: true,
      //   }
      // },
      defineConstants: {
      },
      mini: {
        postcss: {
          autoprefixer: {
            enable: true,
            config: {
              browsers: [
                'last 3 versions',
                'Android >= 4.1',
                'ios >= 8'
              ]
            }
          },
          pxtransform: {
            enable: true,
            config: {
    
            }
          },
          url: {
            enable: true,
            config: {
              limit: 10240 // 设定转换尺寸上限
            }
          },
          cssModules: {
            enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
            config: {
              namingPattern: 'module', // 转换模式,取值为 global/module
              generateScopedName: '[name]__[local]___[hash:base64:5]'
            }
          }
        }
      },
      configureWebpack: {
        performance: {
          hints: 'error',
          maxAssetSize: 5000000, // 整数类型(以字节为单位)
          maxEntrypointSize: 5000000 // 整数类型(以字节为单位)
        },
      },
      h5: {
        // esnextModules: ['taro-ui'],
        publicPath: '/',
        basename: '/womobile',
        staticDirectory: 'static',
        router: {
          // basename: '/wo',
          mode: 'browser',
          customRoutes: {
            '/pages/home/index': '/home',
            '/pages/signin/index': '/signin',
            '/pages/land/land': '/land',
            '/pages/add/add': '/add',
            '/pages/details/details': '/details',
            '/pages/list/list': '/list',
          }
        },
        // performance: {
        //   hints: false
        // },
        postcss: {
          autoprefixer: {
            enable: true,
            config: {
              browsers: [
                'last 3 versions',
                'Android >= 4.1',
                'ios >= 8'
              ]
            }
          },
          cssModules: {
            enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
            config: {
              namingPattern: 'module', // 转换模式,取值为 global/module
              generateScopedName: '[name]__[local]___[hash:base64:5]'
            }
          }
        }
      }
    }
    
    module.exports = function (merge) {
      if (process.env.NODE_ENV === 'development') {
        return merge({}, config, require('./dev'))
      }
      return merge({}, config, require('./prod'))
    }
    
    
    

    ****************prod.js

    module.exports = {
      env: {
        NODE_ENV: '"production"'
      },
      defineConstants: {
      },
      mini: {},
      h5: {
        publicPath: `/womobile`,
        /**
         * 如果h5端编译后体积过大,可以使用webpack-bundle-analyzer插件对打包体积进行分析。
         * 参考代码如下:
         * webpackChain (chain) {
         *   chain.plugin('analyzer')
         *     .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin, [])
         * }
         */
      }
    }
    

登录后回复