Comments (4)
这个问题同微信确认目前没有支持,不过他们会考虑后续如何支持这种写法,在微信支持之前可以先用混合写法把worklet函数静态定义在methods中
from mpx.
@hiyuki 我这边还测试到 worklet 函数即使写在 methods 中,dev 模式可以,但 build 之后就不行了
from mpx.
这是因为terser默认会删除非标准的directives,可以更改terser配置规避这个问题:
new TerserPlugin({
// terserOptions参考 https://github.com/webpack-contrib/terser-webpack-plugin#terseroptions
terserOptions: {
compress: {
// terser的默认行为会把某些对象方法转为箭头函数,导致ios9等不支持箭头函数的环境白屏,详情见 https://github.com/terser/terser#compress-options
arrows: false,
// terser默认会删除非标准directive,为了保障skyline worklet的正常工作,需关闭该配置
directives: false
}
}
}
我们更建议的做法是安装微信提供的babel插件,不仅可以规避上面这个问题,也不用依赖微信开发者工具的es5转义和worklet编译,插件地址:
https://www.npmjs.com/package/babel-plugin-worklet
from mpx.
感谢
from mpx.
Related Issues (20)
- 请问有能让astro或mdx支持适配mpx的集成包吗 HOT 2
- [Feature Request] 支持 Skyline app-bar(全局工具栏) HOT 2
- [Bug report] 接入火山埋点SDK后报错 HOT 1
- [Bug report]@mpxjs/size-report 插件启动可视化平台显示异常 HOT 1
- setComponentRef 方法在支付宝的分包异步化下读缓存是否存在问题? HOT 1
- 是否支持 自动生成页面分包 json 和 统一生成页面路径 .js 或 .ts HOT 4
- [Bug report]是否支持getOpenerEventChannel HOT 4
- [Bug report] wx:class 不兼容多个 class name HOT 1
- [Feature Request] 支持支付宝端的自定义 tabBar HOT 1
- [Bug report]初始化微信小程序插件项目后,yarn serve报错 HOT 3
- [Feature Request] 支持抖音小程序的分包异步化 HOT 1
- 使用van-swipe-cell组件时,无法响应滑动事件 HOT 2
- [Feature Request] customOutputPath 方法支持绝对路径参数
- [Feature Request] api-proxy 支持 getExtConfig 和 getExtConfigSync HOT 1
- [Bug report] mpx每次build,开发者工具报错:在项目根目录未找到 app.json HOT 3
- [Bug report] monorepo 子项目 .mpx 文件找不到在tsconfig path 中声明的模块 HOT 1
- [Feature Request] Web端页面切换会增加页面切换的动画效果,期望该效果是可配置的动画
- [Bug report]通过refs获取的 组件实例top怎么获取 HOT 1
- [Bug report] 对模板里函数名带三元和括号的场景的正则匹配错误 HOT 1
- [Bug report] 支付宝 unocss 不支持 linear-gradient 里使用 var HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mpx.