Closed mattxyzeth closed 2 years ago
I understand more about why this is used now. Is there any other way to perform these tests?
I'm going to close this because my issue was resolved by fixing the plugin position in the rollup config. Once I had that set properly the module that was causing issues was not imported in my service worker.
I should add the proper order for those finding this. In my case I was using this with the commonjs plugin. The proper order is to use commonjs, nodePolyfill, nodeResolve. The nodePolyfill should be before nodeResolve as stated in the examples.
https://github.com/ionic-team/rollup-plugin-node-polyfills/blob/9b5fe1a9cafffd4871e6d65613ed224f807ea251/polyfills/http-lib/capability.js#L20
ServiceWorkers do not include the XMLHttpRequest object. This could be updated to use fetch instead to fix this issue.