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

Expose programmatic API via main in package.json #5

Closed
wants to merge 1 commit into from
Closed

Expose programmatic API via main in package.json #5

wants to merge 1 commit into from

Conversation

perrin4869
Copy link

Solves #4

@puzrin
Copy link
Member

puzrin commented Jun 20, 2016

Sorry, no. I don't like to place kluges here. You need to implement a proper resolver at your side, if you don't like to use require() directly. For example, with require.resolve() or with https://www.npmjs.com/package/resolve

@puzrin puzrin closed this Jun 20, 2016
@perrin4869
Copy link
Author

Can you explain why this is a kluge? It seems like a perfectly good solution to me. I don't see any other good way of importing the function ttf2eof, which is exported by index.js...

The only workaround I see is to use require('ttf2eot/index.js'), but that is very brittle, if in the future you move the content of index.js elsewhere it would break our script...

@puzrin
Copy link
Member

puzrin commented Jun 20, 2016

require('ttf2eot') resolves to index.js properly. See https://nodejs.org/api/modules.html#modules_all_together

@perrin4869
Copy link
Author

ohhh, right! Sorry, my bad!

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

Successfully merging this pull request may close these issues.

2 participants