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
1、processNodeModules设为true
import { defineConfig } from '@morjs/cli' export default defineConfig([ { name: 'web', sourceType: 'wechat', target: 'web', compileType: 'miniprogram', processNodeModules: true, compileMode: 'bundle', cache: false } ])
2、执行npm run dev:web,编译没问题,打开页面报: Cannot read properties of undefined (reading 'ALIPAY') 3、关闭processNodeModules则恢复正常
The text was updated successfully, but these errors were encountered:
看了下编译后的文件,发现在定义ENV_TYPE之前前多了一行代码调用了@morjs/api,注释掉相关代码就正常了
Sorry, something went wrong.
试了下,将注入配置里的api改为lite,使用my对象来替代__MOR_API__能解决这个问题:
{ name: 'web', sourceType: 'wechat', target: 'web', compileType: 'miniprogram', processNodeModules: true, compileMode: 'bundle', autoInjectRuntime: { app: true, page: true, component: true, behavior: true, // API 运行时抹平注入, 指定为 true 时默认为 `enhanced`, 可选值: // enhanced: 增强方式: MorJS 接管 API 调用并提供接口兼容支持 // lite: 轻量级的方式: wx => my, 替换所有全局接口对象 // minimal: 最小替换, 如 wx.abc() => my.abc(), 仅替换函数调用 api: 'lite' }, }
就是不清楚my和__MOR_API__在web下有什么差异,希望官方能给个说明
hwaphon
No branches or pull requests
1、processNodeModules设为true
2、执行npm run dev:web,编译没问题,打开页面报:
Cannot read properties of undefined (reading 'ALIPAY')
3、关闭processNodeModules则恢复正常
The text was updated successfully, but these errors were encountered: