I have created the module, now I want to override the vendor\magento\module-catalog\view\base\web\js\price-utils.js file in my custom module to change in one function.
I tried with below code:
- created
requrejs-config.jsfile in the module as below:
var config = {
map: {
'*': {
'Magento_Catalog/js/price-utils': 'Name_Module/js/price-utils-override'
}
}
};
then copy the file into my module Name\Module\view\frontend\web\js\view\price-utils-override.js.
after content deploy command. it is giving error as below "http://127.0.0.1/test/pub/static/version1545992807/frontend/theme/name/en_GB/Name_Module/js/price-utils.js net::ERR_ABORTED 404 (Not Found)".
What is wrong here, please let me know if anyone has any idea about it.
Thanks.
1 Answer 1
Try below solution
requrejs-config.js
var config = {
map: {
'*': {
'Magento_Catalog/js/price-utils': 'Name_Module/js/view/price-utils-override'
}
}
};
then run below CMD
php bin/magento setup:upgrade
php bin/magento cache:flush
php bin/magento cache:clean
php bin/magento setup:static-content:deploy -f
php bin/magento cache:flush
php bin/magento cache:clean
rm -rf var/*
rm -rf generated/*
I think you missed view in requrejs-config.js file.
I hope it help..!!!
-
appreciated your answer but I am using the module not the theme.Utsav Gupta– Utsav Gupta2018年12月28日 11:52:50 +00:00Commented Dec 28, 2018 at 11:52
-
@UtsavGupta try my new answer's code.Balwant Singh– Balwant Singh2018年12月28日 12:05:06 +00:00Commented Dec 28, 2018 at 12:05
-
@UtsavGupta welcome :) . Please upvote my answer also so that will help another devlopers.Balwant Singh– Balwant Singh2018年12月28日 12:09:33 +00:00Commented Dec 28, 2018 at 12:09