相关平台
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
1条答案
按热度按时间wmomyfyw1#
您好,vite模式还没有支持混合原生,会抽空支持