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

Taro next,prerender无法使用 #5994

Closed
yz1311 opened this issue Apr 15, 2020 · 2 comments
Closed

Taro next,prerender无法使用 #5994

yz1311 opened this issue Apr 15, 2020 · 2 comments
Assignees

Comments

@yz1311
Copy link

yz1311 commented Apr 15, 2020

问题描述

问题1:

prerender的配置为空时会报错

问题2:

taro的prerender对Image组件的src属性处理有问题,编译出来的wxml加上了{{ }},导致无法运行

复现步骤

问题1:

在config/index.js的mini节点添加prerender空节点,照理说没配置match/include/exclude,不应该处理任何的页面

mini: {
     prerender: {
         
     }
}

问题2:

src引用本地图片或者url都会报错(手动在生成的wxml去掉花括号可以正常运行)

本地图片:

<Image className={`top-arc-bg`} mode={'scaleToFill'} src={require('../../resources/img/arc_bg.png')} />

url图片:

<Image className={`top-arc-bg`} mode={'scaleToFill'} src={'https://tva1.sinaimg.cn/large/007S8ZIlgy1gdu9v9jxqyj30ah0933z6.jpg'} />

期望行为

正常运行

报错信息

问题1:

⚠️  页面 app 预渲染失败:
TypeError [Error]: Cannot read property 'onLaunch' of undefined
    at Object.<anonymous> (/Users/zhaoyang/Projects/preplan-taro/dist:3:13)
    at NodeVM.run (/Users/zhaoyang/Projects/preplan-taro/node_modules/vm2/lib/main.js:1044:29)
    at Prerender.<anonymous> (/Users/zhaoyang/Projects/preplan-taro/node_modules/@tarojs/mini-runner/dist/prerender/prerender.js:97:29)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/zhaoyang/Projects/preplan-taro/node_modules/@tarojs/mini-runner/dist/prerender/prerender.js:5:58)

问题2:

本地图片:

url图片:

系统信息

Taro CLI 3.0.0-beta.2 environment info:
System:
OS: macOS 10.14.5
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 12.9.1 - /usr/local/bin/node
Yarn: 1.17.3 - /usr/local/bin/yarn
npm: 6.10.3 - /usr/local/bin/npm
npmPackages:
@tarojs/cli: 3.0.0-beta.2 => 3.0.0-beta.2
@tarojs/components: 3.0.0-beta.2 => 3.0.0-beta.2
@tarojs/taro: 3.0.0-beta.2 => 3.0.0-beta.2
@tarojs/webpack-runner: 3.0.0-beta.2 => 3.0.0-beta.2
eslint-config-taro: 3.0.0-beta.2 => 3.0.0-beta.2
react: ^16.10.0 => 16.13.1
npmGlobalPackages:
typescript: 3.7.4

补充信息

@taro-bot
Copy link

taro-bot bot commented Apr 15, 2020

CC @Chen-jj

@taro-bot
Copy link

taro-bot bot commented Apr 15, 2020

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants