Skip to content
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

publish dual packages (ESM + CommonJS) #69

Open
gabrieljaegerde opened this issue Sep 6, 2021 · 3 comments
Open

publish dual packages (ESM + CommonJS) #69

gabrieljaegerde opened this issue Sep 6, 2021 · 3 comments

Comments

@gabrieljaegerde
Copy link

is it possible to to publish dual packages (ESM + CommonJS), using conditional exports?

@brunopgalvao
Copy link

Is it possible to use rmrk-tools with node? When I try to use it with imports/exports module I get the following error:

$ node script.js
file:///Users/bruno/src/examples/node-dot/getRemarks.js:1
import { fetchRemarks, getRemarksFromBlocks, getLatestFinalizedBlock, Consolidator } from 'rmrk-tools';
                                                                      ^^^^^^^^^^^^
SyntaxError: Named export 'Consolidator' not found. The requested module 'rmrk-tools' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'rmrk-tools';
const { fetchRemarks, getRemarksFromBlocks, getLatestFinalizedBlock, Consolidator } = pkg;

@gabrieljaegerde
Copy link
Author

gabrieljaegerde commented Mar 11, 2022

yes. rmrk has yet to solve this issue. I just end up adding "type": "module" to the rmrk-tools package.json . It is a bit tedious to do it each time I update the dependency but that is my fix for now.

@yornaath
Copy link

It would be nice if "type": "module" could be added to the package json.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@yornaath @brunopgalvao @gabrieljaegerde and others