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

Export a browser version #511

Closed
benmccann opened this issue Aug 22, 2023 · 6 comments
Closed

Export a browser version #511

benmccann opened this issue Aug 22, 2023 · 6 comments

Comments

@benmccann
Copy link
Contributor

We had a user who wanted to use this package on Cloudflare Workers. The Node APIs are not available there so you can't import node:fs. It'd be nice if the other APIs could be made available without that functionality and import

You could make it available in the browser by exporting a smaller subset of APIs that has most of the functionality except for writing to files:

"exports": {
  "browser": "./my-browser-version.js",
  "require": "./my-cjs-version.cjs",
  "default": "./my-esm-version.js",
}
@sebbo2002
Copy link
Owner

In the longer term I plan to release a new major version that does not use fs and http at all (see #478). I also want to introduce some other breaking changes there. Unfortunately I don't have time to work on that at the moment and don't expect to get around to it until autumn at the earliest.

In the meantime, pull requests that fix the problem are of course welcome.

@lschloetterer
Copy link

Just FYI, I got it running in Cloudflare Workers by adding this in the package.json

"browser": {
    "fs": false
}

@sebbo2002
Copy link
Owner

I just pushed a preview of ical-generator v6 to develop, which should fix this issue. I would be happy if you could test the new version and give me some feedback. You can install the version with npm i ical-generator@next. All changes in this release can be found here.

@benmccann
Copy link
Contributor Author

@cimnine does this work for you?

@cimnine
Copy link
Contributor

cimnine commented Oct 21, 2023

Indeed 👍

@sebbo2002
Copy link
Owner

Since v6 has been released for a few days now, I'm closing this ticket. If there are still problems in the browser, feel free to open a ticket again.

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

No branches or pull requests

4 participants