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

feat: support browser environment #629

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

sheepa
Copy link

@sheepa sheepa commented Oct 3, 2022

Support cron format testing, next execution calculation, etc. usage in browsers by not requiring child_process.

TODO

lib/cron.js Outdated
@@ -2,7 +2,7 @@
if (typeof define === 'function' && define.amd) {
define(['luxon'], factory);
} else if (typeof exports === 'object') {
module.exports = factory(require('luxon'), require('child_process'));
module.exports = factory(require('luxon'), (typeof window === 'undefined' ? require('child_process') : {}));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in browsers, typeof exports is undefined not object, so would the execution even get as far as your logic?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure but this was required for me. My guess it's because im running vue with vite.

@sheerlox sheerlox marked this pull request as draft August 15, 2023 16:27
@sheerlox sheerlox added the type:feature New feature or feature improvement & requests label Aug 15, 2023
@sheerlox sheerlox changed the title don't require child_process in browsers feat: don't require child_process in browsers Aug 15, 2023
@sheerlox sheerlox changed the title feat: don't require child_process in browsers feat: support browser environment Sep 26, 2023
@sheerlox
Copy link
Collaborator

sheerlox commented May 28, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New feature or feature improvement & requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants