Does not work on node
Closed this issue ยท 4 comments
Hi, at least for me, it sadly does not work on node (awesome lib btw).
Having looked at the build script, I think there's missing an environment='node'
here
So basically changing
compile(output_dir, 'dist_node', debug=False)
to
compile(output_dir, 'dist_node', debug=False, environment='node')
Hi,
That was exactly the reason. Fixed in v0.4.1.
Thanks for reporting and investigation!
Hi,
thanks for fixing the issue so fast.
Sadly, I still have another problem: in the package.json
, you have a conditional export with import
and node
.
However, import
also matches when you are on nodejs and using "type": "module"
, thus, for me the incorrect version is loaded.
There are multiple ways how this can be fixed:
- Using
node
anddefault
(in this order): according to the docs the best option - Using
node
andbrowser
- Just switching the order of
import
andnode
(it seems to use the first matching) - Also providing named exports so that users can manually decide which one they want
Sidenote: maybe it would be a good idea to use the nesting feature to also provide a commonjs export for node, even though I personally do not care about that one.
I tested it by directly importing index-node.mjs
, that's why it worked. But I like the suggested solutions, especially the first one. I didn't know about it before, thanks! Fixed in v0.4.2 .
works, thx again ๐