Handling Webpack 5 Polyfill issues in Ionic Vue
P粉420868294
P粉420868294 2023-08-30 12:09:41
0
1
357
<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粉420868294
P粉420868294

reply all(1)
P粉573943755

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!