AcalaNetwork / chopsticks

Create parallel reality of your Substrate network.
Apache License 2.0
134 stars 80 forks source link

dual publish #489

Closed qiweiii closed 11 months ago

qiweiii commented 11 months ago

close #487

build for both cjs and esm.

ermalkaleci commented 11 months ago

Only core needs to be dual and this is not dual

qiweiii commented 11 months ago

Only core needs to be dual and this is not dual

@ermalkaleci could you explain a bit

ermalkaleci commented 11 months ago

my understanding of dual is when you have .cjs and .mjs file extension and node will import .cjs and if you enable esm it will choose .mjs file extension

ermalkaleci commented 11 months ago

another thing. Do not change current path. I'm sure it will break somewhere. Just add esm into /lib/esm. The tests are all running ok because our ts setup doesn't require any pre-build to work

qiweiii commented 11 months ago

my understanding of dual is when you have .cjs and .mjs file extension and node will import .cjs and if you enable esm it will choose .mjs file extension

Yes, this is another way to do this

ermalkaleci commented 11 months ago

I don't think we need this anyway. Bundlers will just transform the code and bun for example works with both.

xlc commented 11 months ago

another thing. Do not change current path. I'm sure it will break somewhere. Just add esm into /lib/esm. The tests are all running ok because our ts setup doesn't require any pre-build to work

assuming everything are wired correctly (the export map), everything should work

ermalkaleci commented 11 months ago

keep the current tsconfig and create new one only for esm so vscode won't give warnings

qiweiii commented 11 months ago

keep the current tsconfig and create new one only for esm so vscode won't give warnings

what warnings does it give?

ermalkaleci commented 11 months ago

tools will look for tsconfig.json which doesn't have any reference. we don't need to have 3 tsconfig. Just default one for cjs and another one for esm