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)
- [Bug report]初始化 npm run serve失败,用了楼上的方法仍然失败 HOT 2
- [Bug report]重新安装脚手架后无法create项目
- [Bug report] `mpx.xfetch`的TS类型报错 HOT 1
- <input> does not support [confirm-type] property in bytedance environment![Bug report] HOT 1
- [Bug report] 多次修改样式调试时报:Cannot read property 'call' of undefined HOT 20
- 可以使用 Vue - Official (volar) 代替 mpx插件 HOT 2
- [Bug report]原子类与scoped 样式隔离bug HOT 2
- Skyline是否支持 HOT 1
- webstorm 2024.1.1什么时候支持mpx插件呢 HOT 2
- [Bug report] 关于编译过程中修改样式导致小程序预览提示报错。 HOT 1
- [Bug report] wxml 存在 <template is="xxx" /> 引用模板的时候,template 里边的事件没法编译,使用不了proxyEventHandler HOT 1
- 请问有能让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
- [Feature Request] 支持支付宝端的自定义 tabBar HOT 1
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.