Skip to content

修改了h5配置的entry,编译后页面白屏 #17277

@hzeeli

Description

@hzeeli

相关平台

H5

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

复现步骤

配置文件:

// - config/index.ts

const baseConfig: UserConfigExport<'webpack5'> = {

// ...other code

h5: {
      entry: {
        app: `${path.resolve(__dirname, '../src/entry/app.tsx')}`
      }
    }
}

entry所在目录:

src

entry

app.tsx # 入口文件
app.config.ts #配置文件

官方demo做此简单修改可复现
附一个codesandbox代码

期望结果

期望能正确关联路由

实际结果

未正确渲染,白屏

环境信息

👽 Taro v4.0.9

  Taro CLI 4.0.9 environment info:
    System:
      OS: macOS 14.5
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 18.20.5 - /usr/local/bin/node
      Yarn: 1.22.22 - /usr/local/bin/yarn
      npm: 10.8.2 - /usr/local/bin/npm
    npmPackages:
      @tarojs/cli: 4.0.9 => 3.6.25 
      @tarojs/components: 4.0.9 => 3.6.25 
      @tarojs/helper: 4.0.9 => 3.6.25 
      @tarojs/plugin-framework-react: 4.0.9 => 3.6.25 
      @tarojs/plugin-platform-alipay: 4.0.9 => 3.6.25 
      @tarojs/plugin-platform-h5: 4.0.9 => 3.6.25 
      @tarojs/plugin-platform-jd: 4.0.9 => 3.6.25 
      @tarojs/plugin-platform-qq: 4.0.9 => 3.6.25 
      @tarojs/plugin-platform-swan: 4.0.9 => 3.6.25 
      @tarojs/plugin-platform-tt: 4.0.9 => 3.6.25 
      @tarojs/plugin-platform-weapp: 4.0.9 => 3.6.25 
      @tarojs/react: 4.0.9 => 3.6.25 
      @tarojs/runtime: 4.0.9 => 3.6.25 
      @tarojs/shared: 4.0.9 => 3.6.25 
      @tarojs/taro: 4.0.9 => 3.6.25 
      @tarojs/taro-loader: 4.0.9 => 3.6.25 
      @tarojs/webpack5-runner: 4.0.9 => 3.6.25 
      babel-preset-taro: 4.0.9 => 3.6.25 
      react: ^18.0.0 => 18.3.1 
    npmGlobalPackages:
      typescript: 5.4.5

补充信息

背景是想可以有多个app入口,脚本可选指定app打包。
微信小程序能跑通这个流程,但h5失败了

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions