Ecommerce Shopify WordPress Discussion

Google Storage Node JS library from WordPress produces 85 errors

I created a Wordpress environment where Node JS libraries are loaded into a Wordpress plugin. npm -g i @wordpress/scripts npx @wordpress/create-starter-block x wp-env start npm run start I followed the starter guide here I installed the Google Cloud Storage library with npm install @google-cloud/storage but when I import the library with the below code, I get webpack errors. const {Storage} = require('@google-cloud/storage'); ERROR in ./node_modules/tunnel-agent/index.js 5:11-26 Module not found: Error: Can't resolve 'http' in '/Users/x/x/x/node_modules/tunnel-agent' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "http": require.resolve("stream-http") }' - install 'stream-http' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "http": false } @ ./node_modules/request/lib/tunnel.js 4:13-36 @ ./node_modules/request/request.js 29:13-43 @ ./node_modules/request/index.js 143:18-38 @ ./node_modules/@google-cloud/storage/src/bucket.js 29:16-34 @ ./node_modules/@google-cloud/storage/src/index.js 24:15-37 @ ./node_modules/webpack-google-cloud-storage-plugin/dist/webpack-google-cloud-storage-plugin.js 3:48-80 2806:18-50 @ ./src/edit.js 34:0-82 @ ./src/index.js 20:0-26 33:8-12 There are 85 variations of the above error, with different package names. I tried adding the config.js overwrite file with the fallbacks, but this is difficult to do when downstream libraries are also outputting this error. Not sure what I'm doing wrong but it's just the addition of the require library that triggers these errors. There is no other JS code.
TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.