Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

钉钉小程序升级3.5问题 #11934

Open
ajuner opened this issue Jun 14, 2022 · 1 comment
Open

钉钉小程序升级3.5问题 #11934

ajuner opened this issue Jun 14, 2022 · 1 comment
Labels
F-react good first issue T-dd V-3

Comments

@ajuner
Copy link

@ajuner ajuner commented Jun 14, 2022

相关平台

钉钉小程序

使用框架: React

复现步骤

3.4版本升级至3.5

期望结果

升级成功

实际结果

升级失败

环境信息

👽 Taro v3.5.0-beta.0


  Taro CLI 3.5.0-beta.0 environment info:
    System:
      OS: Windows 10
    Binaries:
      Node: 16.14.0 - D:\Program Files\nodejs\node.EXE
      Yarn: 1.22.17 - C:\Users\caiju\AppData\Roaming\npm\yarn.CMD
      npm: 8.3.1 - D:\Program Files\nodejs\npm.CMD

补充信息

prebundle

  1. 自定义cacheDir会出现第一次启动失败,第二次成功的问题,第一次cacheDir路径下只有prebundle、webpack-cache文件夹,没有remote文件夹。
    image
  2. prebundle的时候taro-ui中缺失OpenData组件导致扫描不通过,暂时exclude解决

运行时

  1. \taro\packages\taro-alipay\src\runtime.ts 提示userAgent不存在,暂时exclude解决

image

image

  1. 支付宝小程序不支持这种es6写法,在prebundle阶段先用swc转换成es5了
    Qt = class extends Map{}
    new Qt()
    image

5.目前卡在这一步,问题在编译后的taro.js中
image

image

@taro-bot2 taro-bot2 bot added F-react T-dd V-3 labels Jun 14, 2022
@ajuner
Copy link
Author

@ajuner ajuner commented Jun 15, 2022

在custom-tab-bar下就能复现
新增taro-ui以及@tarojs/plugin-platform-alipay-dd插件

贴一下config

const path = require('path');
const fs = require('fs');
const swc = require('@swc/core');

const config = {
  compiler: {
    type: 'webpack5',
    prebundle: {
      enable: true,
      cacheDir: path.resolve(__dirname, '../cache'),
      exclude: ['@tarojs/plugin-platform-alipay-dd/dist/runtime', 'taro-ui'],
      esbuild: {
        plugins: [
          {
            name: 'esbuildResolve',
            setup(build) {
              build.onLoad({ filter: /node_modules/ }, async (args) => {
                const text = await fs.promises.readFile(args.path, 'utf8');
                const result = await swc.transform(text, {
                  jsc: {
                    target: 'es5',
                  },
                });
                return {
                  contents: result.code,
                };
              });
            },
          },
        ],
      },
    },
  },
  cache: {
    enable: true
  },
  projectName: 'custom-tabbar-react',
  date: '2022-2-22',
  designWidth: 750,
  deviceRatio: {
    640: 2.34 / 2,
    750: 1,
    828: 1.81 / 2
  },
  sourceRoot: 'src',
  outputRoot: 'dist',
  plugins: [
    '@tarojs/plugin-platform-alipay-dd',
  ],
  defineConstants: {
  },
  copy: {
    patterns: [
    ],
    options: {
    }
  },
  framework: 'react',
  mini: {
    postcss: {
      pxtransform: {
        enable: true,
        config: {

        }
      },
      url: {
        enable: true,
        config: {
          limit: 1024 // 设定转换尺寸上限
        }
      },
      cssModules: {
        enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
        config: {
          namingPattern: 'module', // 转换模式,取值为 global/module
          generateScopedName: '[name]__[local]___[hash:base64:5]'
        }
      }
    }
  },
  h5: {
    publicPath: '/',
    staticDirectory: 'static',
    postcss: {
      autoprefixer: {
        enable: true,
        config: {
        }
      },
      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'))
}

@Chen-jj Chen-jj added the good first issue label Jun 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react good first issue T-dd V-3
Projects
None yet
Development

No branches or pull requests

2 participants