gpt4 book ai didi

javascript - 将纯 Nativescript 5.x 项目迁移到 Nativescript 6 - JS ERROR NOT READY : generator isn't seeded

转载 作者:行者123 更新时间:2023-12-02 22:22:48 29 4
gpt4 key购买 nike

将纯 Nativescript 5.x 项目迁移到 Nativescript 6使用 nativescript-nodeify (0.8.0) 、 sjcl (1.0.8) 和 uuid (3.3.3)
在 ios 或 android 上执行时,sjcl.random.randomWords(PBKDF2_SALT_SIZE) 抛出错误 - JS 错误未就绪:生成器未播种

尝试了不同的方法在 webpack 中配置加密。还是没能解决这个错误!在这方面的任何帮助将不胜感激!!!

最佳答案

Solution : https://stackoverflow.com/questions/53172766/how-to-use-ripple-lib-with-nativescript/53925032#53925032
1. Add NativeScript plugin to the project:
tns plugin add nativescript-randombytes
2. Create a file that will be a partial implementation of crypto module:
// Example path: project/app/shims/crypto.js
module.exports.randomBytes = require('nativescript-randombytes')
3. Add it to webpack.config.js in plugins configuration:
plugins: [
..., // other plugins
new webpack.ProvidePlugin({
crypto: resolve(__dirname, 'app/shims/crypto.js')
})
]
4. Add resolve.alias for our version of crypto in webpack.config.js, so child dependencies require our crypto implementation:

alias: {
..., // Other aliases
'crypto': resolve(__dirname, 'app/shims/crypto.js')
}
5. rm -rf platforms/android # or ios
rm -rf hooks
rm -rf node_modules
6. tns platform remove ios/android
7. tns platform add ios/android
8. tns build ios/android --bundle
9. tns run ios/android --bundle

关于javascript - 将纯 Nativescript 5.x 项目迁移到 Nativescript 6 - JS ERROR NOT READY : generator isn't seeded,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59171898/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com