Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

Document what is needed to use this library in Webpack #199

Open
mcmire opened this issue Feb 22, 2023 · 2 comments
Open

Document what is needed to use this library in Webpack #199

mcmire opened this issue Feb 22, 2023 · 2 comments

Comments

@mcmire
Copy link
Contributor

mcmire commented Feb 22, 2023

Although we use Browserify, many people use Webpack, so we should document how to use this library with Webpack.

@mcmire
Copy link
Contributor Author

mcmire commented Feb 22, 2023

According to #198, you may need:

resolve: {
  extensions: ['.ts', '.js'],
  fallback: {
    stream: require.resolve('stream-browserify'),
    buffer: require.resolve('buffer'),
    crypto: require.resolve('crypto-browserify'),
    global: require.resolve('globalthis'),
    process: require.resolve('process')
  }
},
plugins: [
  new CopyWebpackPlugin({
    patterns: [
      {
        from: 'node_modules/webextension-polyfill/dist/browser-polyfill.js'
      }
    ]
  }),
  new webpack.ProvidePlugin({
    global: require.resolve('globalthis')
  }),
  new webpack.ProvidePlugin({
    process: require.resolve('process')
  })
]

We should investigate whether this is truly the minimal set of configuration needed or whether we can make this simpler.

@ko1ebayev
Copy link

ko1ebayev commented Feb 24, 2023

@mcmire Since I have fixed instantiating keyring controller, his methods don't work correctly. Ex. in service worker environment Im trying to call createNewVaultAndKeychain(), documentation says that this method creates 1 new random account so under the hood @scure/bip39 lib's methods getting called and this gives another error:

image

Error's entry point is in /@metamask/browser-passworder/dist/index.js
image

Any idea or recommendations how can I completely setup keyring controller?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants