search

Home  >  Q&A  >  body text

Handling Webpack 5 Polyfill issues in Ionic Vue

<p>I'm trying to use the cosmjs package with Ionic Vue. When I want to import</p> <pre class="brush:php;toolbar:false;">import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing";</pre> <p>I got this question: </p> <pre class="brush:php;toolbar:false;">If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "crypto": false }</pre> <p>And the application cannot be used within the application. </p>
P粉420868294P粉420868294460 days ago416

reply all(1)I'll reply

  • P粉573943755

    P粉5739437552023-08-31 00:08:56

    According to the Ionic and Vue documentation you can easily incorporate custom objects into the final webpack configuration.

    First, install the browser version of the encryption module by executing the following command:

    npm install crypto-browserify

    You should then create a vue.config.js file in your project root directory like this:

    // vue.config.js
    
    module.exports = {
        configureWebpack: {
            resolve: {
                fallback: {
                    crypto: require.resolve( 'crypto-browserify' )
                    // Any other missed node module
                }
            }
        }
    };
    
    

    You should be able to repeat this process for each missed node-native module that has a browser version.

    reply
    0
  • Cancelreply