Closed kevinsimper closed 5 years ago
Closing this as it's already working without the source code.
@lquixada None of the published code in the npm package is using ES6 Modules, it is either CJS or bundled code...
Have you tried using cross-fetch
with esm?
Maybe I'm not getting the point. Here's how to reproduce what I've done:
$ git clone -b esm git@github.com:lquixada/cross-fetch.git
$ cd cross-fetch/example
$ npm install
$ node -v
v8.11.3
$ node -r esm github.esm.js
This works without cross-fetch published with ESM. Did I get something wrong?
@lquixada You are right, that works perfectly, I then tried making my own example, that worked at well.
Then I tried to reproduce it with polymer-cli which was what I used that 1.5 month ago and that provoked the error I got: https://github.com/kevinsimper/cross-fetch-esm-test
127.0.0.1/:1 Uncaught SyntaxError: The requested module '../node_modules/cross-fetch/dist/node-ponyfill.js' does not provide an export named 'default'
https://github.com/kevinsimper/cross-fetch-esm-test/blob/master/src/test.js#L1
I remembered wrong about esm, and you are right that it works with that, it doesn't seem to work in the browser with type="module"
I don't know what to take away from this, hope it can be fixed :)
Awesome responses 👍
Then the code can be used with https://www.npmjs.com/package/esm 😄