-
-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fluture with esm
#274
Comments
Have you tried I haven't used it with esm yet, but I'm using Edit: I am actually using it with esm (although |
@yeldiRium Thanks, but it seems that it's not exporting anything, named nor default. |
Thanks for the report. I've reproduced it: $ cd `mktemp -d`
$ npm i fluture esm
+ fluture@9.0.1
+ esm@3.0.80
added 8 packages from 3 contributors and audited 12 packages in 1.359s
found 0 vulnerabilities
$ echo 'import {reject} from "fluture";' > index.js
$ node -r esm index.js
file:///tmp/tmp.CRUBSFiSqW/index.js:1
SyntaxError: Missing export name 'reject' in ES module: file:///tmp/tmp.CRUBSFiSqW/node_modules/fluture/index.js
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10) The reason is that the wrong file is being loaded ( The Line 7 in 7c498a3
I'll investigate further. |
I believe this happens because the "module" field in package.json is a "standard" set by the various build tools out there to distinguish between modular JavaScript and ESM. Node, however, decided to go with file extension to make the distinction. So when loading a dependency with Node's This is why This issue is loosely related to the "Upgrade to ESM" item on the Roadmap. Once I would fix the file extensions on the modular JavaScript files, Node and The reason I haven't done this yet is because many tools are not ready for the change. Babel, for example, only just started acknowledging the existence of the |
@henriklundgren I think you might be able to work around it for now by setting the |
@henriklundgren I'm working on a fix in #276 :) |
Seems like that branch fixes the issue. $ cd `mktemp -d`
$ npm i fluture-js/fluture#avaq/mjs esm
+ esm@3.0.80
+ fluture@9.0.2
added 8 packages from 3 contributors and audited 12 packages in 4.697s
found 0 vulnerabilities
$ echo 'import {resolve} from "fluture"; resolve(42).value(console.log);' > index.js
$ node -r esm index.js
42
$ cp index.js index.mjs
$ node --experimental-modules --no-warnings index.mjs
42 I will be releasing it soon along with some additional minor breaking changes. Until then, @henriklundgren, you can install Fluture with |
I am unable to use Fluture with
esm
.The text was updated successfully, but these errors were encountered: