Closed dimasch closed 6 years ago
The possible workaround in load external paypal script https://www.paypalobjects.com/api/checkout.min.js
to sw-precache
storage.
See https://stackoverflow.com/questions/40587733/caching-external-resources-with-sw-precache
Variant to install sw-toolbox
and precache the external checkout.js
in theme.
yarn lerna add sw-toolbox --scope @vue-storefront/theme-default
+ @collymore
I find workaround
1) yarn lerna add sw-toolbox --scope @vue-storefront/theme-default
2) In theme ./service-worker/index.js
import toolbox from 'sw-toolbox'
toolbox.precache(['dist/checkout.js'])
3) yarn lerna add copy-webpack-plugin --scope @vue-storefront/theme-default
4) In theme ./webpack.config.js
new CopyWebpackPlugin([
{ from: './extensions/lib/checkout.min.js', to: 'dest/' }
], options)
Ultra fast workaround:
Add checkout.js script to theme index ./src/themes/default/index.template.html
as a link <script src="https://www.paypalobjects.com/api/checkout.min.js" async></script>
My additional attribute async
for load script in async mode and not block load app.js etc.
Or async form:
<script type="text/javascript">
(function() {
var wf = document.createElement('script');
wf.src = ('https:' == document.location.protocol ? 'https' : 'https') +
'://www.paypalobjects.com/api/checkout.min.js';
wf.type = 'text/javascript';
wf.async = 'true';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(wf, s);
})();
</script>
Reopened.
Fixed in #39
It's not bloked checkout process, but need for fix.