导航

    Taro 社区

    Taro

    • 注册
    • 登录
    • 搜索
    • 版块
    • 最新
    • 话题
    • 热门
    • 群组
    1. 主页
    2. cuiyibao0725
    C
    • 资料
    • 关注
    • 粉丝
    • 主题
    • 帖子
    • 最佳
    • 群组

    cuiyibao0725

    @cuiyibao0725

    0
    声望
    1
    帖子
    396
    资料浏览
    0
    粉丝
    0
    关注
    注册时间 最后登录

    cuiyibao0725 关注

    cuiyibao0725 发布的帖子

    • Taro convert转换小程序代码踩坑,持续更新中...

      @tarojs/cli/src/convert/helper.ts的analyzeImportUrl函数只对绝对地址和相对地址的文件做处理,没有对只是模块名的做处理

      自己加了处理代码:

      let pathArr = sourceFilePath.split('/')
      let dirPath = ''
      pathArr.forEach((ele, ind) => {
          dirPath += ele + '/'
          let vpath = resolveScriptPath(path.resolve(dirPath, 'miniprogram_npm', value))
          if (vpath) {
            if (fs.existsSync(vpath)) {
              if (fs.lstatSync(vpath).isDirectory()) {
                if (fs.existsSync(path.join(vpath, 'index.js'))) {
                  vpath = path.join(vpath, 'index.js')
                } else {
                  printLog(processTypeEnum.ERROR, '引用目录', `文件 ${sourceFilePath} 中引用了目录 ${value}!`)
                  return
                }
              }
              scriptFiles.add(vpath)
            }
          }
        })
      

      @tarojs/cli/src/convert/index.ts的parseAst函数缺少对(export * from './lib/utils/request')这种es6模块化加载的处理

      自己加了处理代码:

      ExportAllDeclaration (astPath) {
          const node = astPath.node
          const source = node.source
          const value = source.value
          analyzeImportUrl(sourceFilePath, scriptFiles, source, value)
      }
      
      发布在 提 Bug
      C
      cuiyibao0725