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

v4.0.4版本,使用vite编译不能正确识别page页面里引入的自定义多端组件 #16265

Open
Rambos opened this issue Aug 7, 2024 · 1 comment
Labels
F-react Framework - React T-h5 Target - 编译到 H5 V-4 Version - 4.x

Comments

@Rambos
Copy link

Rambos commented Aug 7, 2024

相关平台

H5

浏览器版本: Chrome
使用框架: React

复现步骤

页面里通过import引入的自定义组件 vite build不能正确识别多端文件,webpack没有这个问题。

/**
 * 测试文件结构
 * - src/
 *   - page/
 *     - index/
 *       - index.tsx
 *       - index.h5.tsx    // 这个h5多端文件可以正确build
 *    - components/
 *      - comp/
 *        - index.tsx
 *        - index.h5.tsx  // 这个文件不能被正确build
 * /
// page/index/index

import Comp from "@/components/comp";  // 这里comp组件有多端文件

function Index(){
  return (
    <Comp />
  )
}
#执行build
npm run build:h5

期望结果

vite能正确build,

实际结果

vite不能正确编译多端文件

环境信息

Taro CLI 4.0.4 environment info:
    System:
      OS: macOS 14.5
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 18.6.0 - /usr/local/bin/node
      Yarn: 1.21.1 - /usr/local/bin/yarn
      npm: 8.13.2 - /usr/local/bin/npm
    npmPackages:
      @tarojs/cli: 4.0.4 => 4.0.4 
      @tarojs/components: 4.0.4 => 4.0.4 
      @tarojs/helper: 4.0.4 => 4.0.4 
      @tarojs/plugin-framework-react: 4.0.4 => 4.0.4 
      @tarojs/plugin-platform-alipay: 4.0.4 => 4.0.4 
      @tarojs/plugin-platform-h5: 4.0.4 => 4.0.4 
      @tarojs/plugin-platform-harmony-hybrid: 4.0.4 => 4.0.4 
      @tarojs/plugin-platform-jd: 4.0.4 => 4.0.4 
      @tarojs/plugin-platform-qq: 4.0.4 => 4.0.4 
      @tarojs/plugin-platform-swan: 4.0.4 => 4.0.4 
      @tarojs/plugin-platform-tt: 4.0.4 => 4.0.4 
      @tarojs/plugin-platform-weapp: 4.0.4 => 4.0.4 
      @tarojs/react: 4.0.4 => 4.0.4 
      @tarojs/runtime: 4.0.4 => 4.0.4 
      @tarojs/shared: 4.0.4 => 4.0.4 
      @tarojs/taro: 4.0.4 => 4.0.4 
      @tarojs/vite-runner: 4.0.4 => 4.0.4 
      babel-preset-taro: 4.0.4 => 4.0.4 
      eslint-config-taro: 4.0.4 => 4.0.4 
      react: ^18.0.0 => 18.0.0 
    npmGlobalPackages:
      typescript: 3.8.3
@taro-bot2 taro-bot2 bot added F-react Framework - React T-h5 Target - 编译到 H5 V-3 Version - 3.x labels Aug 7, 2024
@github-project-automation github-project-automation bot moved this to Padding in H5 Aug 7, 2024
@TheKonka TheKonka added V-4 Version - 4.x and removed V-3 Version - 3.x labels Aug 7, 2024
This was referenced Aug 10, 2024
@ZEJIA-LIU
Copy link
Contributor

您好,vite模式还没有支持混合原生,会抽空支持

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-h5 Target - 编译到 H5 V-4 Version - 4.x
Projects
Status: Padding
Development

No branches or pull requests

3 participants