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

taro3.x config配置 alias选项 暂不支持转换usingComponents #8472

Closed
fengyun2 opened this issue Jan 8, 2021 · 0 comments
Closed

taro3.x config配置 alias选项 暂不支持转换usingComponents #8472

fengyun2 opened this issue Jan 8, 2021 · 0 comments
Labels
enhancement New feature or request F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Milestone

Comments

@fengyun2
Copy link

fengyun2 commented Jan 8, 2021

相关平台

微信小程序

小程序基础库: 2.14.3
使用框架: React

复现步骤

源码

// config/index.js

import { resolve } from 'path'

  alias: {
    '@vant-weapp': resolve(__dirname, '..', 'node_modules/@vant/weapp/dist')
  },
// pages/index/index.config.js

export default {
  navigationBarTitleText: '首页',
  usingComponents: {
    'van-button': '@vant-weapp/button/index',
    'van-calendar': '@vant-weapp/calendar/index'
  }
}

## 报错信息

```shell
[ dist/pages/index/index.json 文件内容错误] dist/pages/index/index.json: ["usingComponents"]["van-button"]: "@vant-weapp/button/index" 未找到

image

补充

taro -cli 2.x 会这样编译解析:

// packages/taro-cli/src/weapp.js 

 Object.keys(usingComponents).map(async item => {
      const componentPath = usingComponents[item]
      let componentPath = usingComponents[item]

      if (Util.isAliasPath(componentPath, pathAlias)) {
        componentPath = Util.replaceAliasPath(configFile, componentPath, pathAlias)
        usingComponents[item] = componentPath
      }

期望结果

路径别名可以被正确解析

实际结果

路径别名可以未能被解析

环境信息

� Taro v3.0.22


  Taro CLI 3.0.22 environment info:
    System:
      OS: Windows 10
    Binaries:
      Node: 12.18.0 - E:\nvmNode\node.EXE
      Yarn: 1.22.4 - E:\nvmNode\yarn.CMD
      npm: 6.14.4 - E:\nvmNode\npm.CMD
@taro-bot2 taro-bot2 bot added F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels Jan 8, 2021
@Chen-jj Chen-jj added the enhancement New feature or request label Jan 8, 2021
@Chen-jj Chen-jj added this to the 3.0.25 milestone Jan 21, 2021
@Chen-jj Chen-jj mentioned this issue Jan 22, 2021
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Projects
None yet
Development

No branches or pull requests

2 participants