We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Rax Core
// 执行 yarn build:prod 多次,以下addNativeEventListener添加的onPullDownRefresh会失效,页面下拉无效果。 const ProfileUser = () => { useEffect(() => { if (isWeChatMiniProgram) { addNativeEventListener('onPullDownRefresh', handlePullDownRefresh); } return () => { if (isWeChatMiniProgram) { removeNativeEventListener('onPullDownRefresh', handlePullDownRefresh); } }; }, []); return };
if (isWeChatMiniProgram) { registerNativeEventListeners(ProfileUser, ['onPullDownRefresh']); } export default ProfileUser;
多次编译打包,部分addNativeEventListener添加的小程序原生事件(onPullDownRefresh、onShareAppMessage,)失效, 只有重新修改registerNativeEventListeners周边的代码,再次打包才会重新生效。 即每次build要反复修改如下: =======================反复 if (isWeChatMiniProgram) { registerNativeEventListeners(ProfileUser, ['onPullDownRefresh']); } =======================反复 // if (isWeChatMiniProgram) { registerNativeEventListeners(ProfileUser, ['onPullDownRefresh']); // }
微信开发者工具
const path = require('path'); const settings = require(path.resolve(__dirname, './src/settings.js')); const ossEnv = process.env.npm_lifecycle_event.split(':')[1] || 'local'; module.exports = { targets: ['web', 'wechat-miniprogram'], // targets: ['wechat-miniprogram'], webpack5: true, plugins: ['build-plugin-fusion-mobile', './build.plugin.js'], inlineStyle: false, lessLoaderOptions: { additionalData: @ossURL:" + settings[ossEnv].ossURL + ";, }, 'wechat-miniprogram': { // buildType: 'runtime', // 开启运行时引擎 nativeConfig: { appid: 'wx8407a97a7b55d6cd', setting: { ignoreDevUnusedFiles: false, ignoreUploadUnusedFiles: false, }, }, // subPackages: { // shareMemory: true, // }, subPackages: true, }, web: { mpa: true, tabbar: true, }, };
@ossURL:"
";
No response
The text was updated successfully, but these errors were encountered:
同样碰到了,同样的代码 有时候打包好的,有时候打包出来分享就失效了
Sorry, something went wrong.
No branches or pull requests
⌨️
Where is the bug from?
Rax Core
Minimal code and steps to reproduce the bug
// 执行 yarn build:prod 多次,以下addNativeEventListener添加的onPullDownRefresh会失效,页面下拉无效果。
const ProfileUser = () => {
useEffect(() => {
if (isWeChatMiniProgram) {
addNativeEventListener('onPullDownRefresh', handlePullDownRefresh);
}
return () => {
if (isWeChatMiniProgram) {
removeNativeEventListener('onPullDownRefresh', handlePullDownRefresh);
}
};
}, []);
return
};
if (isWeChatMiniProgram) {
registerNativeEventListeners(ProfileUser, ['onPullDownRefresh']);
}
export default ProfileUser;
Current and expected behavior
多次编译打包,部分addNativeEventListener添加的小程序原生事件(onPullDownRefresh、onShareAppMessage,)失效,
只有重新修改registerNativeEventListeners周边的代码,再次打包才会重新生效。
即每次build要反复修改如下:
=======================反复
if (isWeChatMiniProgram) {
registerNativeEventListeners(ProfileUser, ['onPullDownRefresh']);
}
=======================反复
// if (isWeChatMiniProgram) {
registerNativeEventListeners(ProfileUser, ['onPullDownRefresh']);
// }
Environment
微信开发者工具
build.json
const path = require('path');
const settings = require(path.resolve(__dirname, './src/settings.js'));
const ossEnv = process.env.npm_lifecycle_event.split(':')[1] || 'local';
module.exports = {
targets: ['web', 'wechat-miniprogram'],
// targets: ['wechat-miniprogram'],
webpack5: true,
plugins: ['build-plugin-fusion-mobile', './build.plugin.js'],
inlineStyle: false,
lessLoaderOptions: {
additionalData:
@ossURL:"
+ settings[ossEnv].ossURL +";
,},
'wechat-miniprogram': {
// buildType: 'runtime', // 开启运行时引擎
nativeConfig: {
appid: 'wx8407a97a7b55d6cd',
setting: {
ignoreDevUnusedFiles: false,
ignoreUploadUnusedFiles: false,
},
},
// subPackages: {
// shareMemory: true,
// },
subPackages: true,
},
web: {
mpa: true,
tabbar: true,
},
};
Possible solution
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: