Polyfills for native crypto
This commit is contained in:
parent
b2dd8d4f44
commit
77b938845a
15 changed files with 243 additions and 81 deletions
|
@ -11,9 +11,11 @@ console.log(metroResolver)
|
|||
module.exports = {
|
||||
resolver: {
|
||||
resolveRequest: (context, moduleName, platform) => {
|
||||
// HACK
|
||||
// metro doesn't support the "exports" directive in package.json
|
||||
// so we have to manually fix some imports
|
||||
// see https://github.com/facebook/metro/issues/670
|
||||
// -prf
|
||||
if (moduleName.startsWith('ucans')) {
|
||||
const subpath = moduleName.split('/').slice(1)
|
||||
if (subpath.length === 0) {
|
||||
|
@ -34,14 +36,19 @@ module.exports = {
|
|||
filePath,
|
||||
}
|
||||
}
|
||||
// HACK
|
||||
// this module has the same problem with the "exports" module
|
||||
// but also we need modules to use our version of webcrypto
|
||||
// so here we're routing to a module we define
|
||||
// -prf
|
||||
if (moduleName === 'one-webcrypto') {
|
||||
return {
|
||||
type: 'sourceFile',
|
||||
filePath: path.join(
|
||||
context.projectRoot,
|
||||
'node_modules',
|
||||
'one-webcrypto',
|
||||
'browser.mjs',
|
||||
'src',
|
||||
'platform',
|
||||
'polyfills.native.ts',
|
||||
),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue