woocommerce / woocommerce

A customizable, open-source ecommerce platform built on WordPress. Build any commerce solution you can imagine.
https://woocommerce.com
9.42k stars 10.77k forks source link

[Enhancement]: Add wc-price-format script to @woocommerce/dependency-extration-webpack-plugin #45464

Open helgatheviking opened 8 months ago

helgatheviking commented 8 months ago

Describe the solution you'd like

Having a lot of issues displaying prices in store currency in extensions using React. wc.priceFormat() can sometimes be accessed via in the window object, but only if one of woo's blocks is loaded... which enqueues wc-price-format

import { formatPrice } from '@woocommerce/price-format';

Doesn't actually import anything since @woocommerce/price-format doesn't exist in the dependency injector

cc @opr

Describe alternatives you've considered

I can also manually include wc-price-format as a dependency, but this will be easier and a nice stopgap until you have a universal store currency formatted component.

Additional context

https://woocommercecommunity.slack.com/archives/C03MCL9RTAR/p1709909491893599?thread_ts=1709835628.552119&cid=C03MCL9RTAR

tammullen commented 6 months ago

Being looked at in https://github.com/woocommerce/woocommerce/pull/47099